Selector Question
Selector Question
hi,
i want to change the val() in a textfield named 'input-field-1-value'
i have more than one textfields and near each textfield is a button
<input id= 'input-field-1-value'><button class='button' val='1'>Field 1</button>
<input id= 'input-field-2-value'><button class='button' val='2'>Field 2</button>
<input id= 'input-field-3-value'><button class='button' val='3'>Field 3</button>
<input id= 'input-field-4-value'><button class='button' val='4'>Field 4</button>
if i click on the button the val of the textfield should change:
$('.button').click(function() {
$("input-field-[$this.val()]-value").val('ok');
});
it's only the logic, it dosn't work so.
How should the Selector look like?
Thanks for the help! :)
Tobi