Position eq() issue in selector
Hi -
I am trying to get a selector to work using eq to find a specific input element and add an attribute:
-
$(this + '.fieldcontrol > div:eq(1) > input').attr('value','Up');
I have tried replacing this with the id of the element in focus with no luck either.
Extremely simplified html code is a
-
<form>
...
<td class="fieldcontrol">
<div><input type="hidden" /></div>
<div><input type="hidden" /></div> <!-- add value to this element -->
<div><input type="hidden" /></div>
</td>
...
</form>
I am quite new at JQuery so sorry if this is me being stupid: I have tried loads of variations but it seems to specifically dislike the eq(n) filter because
-
$(this + '.fieldcontrol > div > input').attr('value','Up');
works if I wanted to add the value to all the child inputs in the code above.
Cheers