88
rated 0 times
[
95]
[
7]
/ answers: 1 / hits: 52948
/ 13 Years ago, tue, january 31, 2012, 12:00:00
Assume I have the following HTML -
<DIV id=ParentDiv>
<DIV id=SubDiv1></DIV>
<DIV id=SubDiv2>
<INPUT id=input>
</DIV>
</DIV>
To access the input element using jquery, it would be simply $(#input). What I'm trying to do is access it, assuming I only know the ID of the top level div.
Currently I have
$($($(#ParentDiv).children()[1]).children()[0])
Which does seem to work. Is there a cleaner way of writing this, or is the way I am doing it ok?
More From » jquery