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 :)
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 :)
Are you using jquery? If you were it would be as easy as
$('#parent .1')
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??
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.