so I have a bunch of DIVs containing inputs named by ints.

I have the parent DIV of these DIVs, but now I'm stuck at:

var div = parent.children()[index]

what I want to do is get the child <input> by it's name "0".
how can I do this??

thanks :)

3 Years
Discussion Span
Last Post by Tcll

I'm trying to stay away from direct reference though as it needs to be dynamic...
but I could make that work I guess >.>

$('#parent .'+index+' .0')

EDIT: wait a minute... that's class reference... not name reference. >.<
the DIV is dynamically created while it's children are also dynamic.
I'm using an index to track them because I also have to fill a textarea with a list containing the data those children hold.

it's bad to specify class="0", so I'm using name="0" with id="index".

I specifically asked for the name.
how can I reference by name??

Edited by Tcll


never mind the original Q...
I had to modify my code to give the input a class "input-0", as will as supply which position it modifies in the function it calls onclick.

my guess is jquery doesn't like the name attribute but for reference by .attr('name') which would not have worked in my earlier case.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.