Reputation: 2275
I have a problem that want to solve it with jQuery.
I have some div with id's "div1,div2,...". In each div I have an input with name pattern.
For example like this
<div id="div1">
<table>....</table>
<div>....</div>
<input name="pattern" value="nothing" />
</div>
I want to get this input for "div1". I can get div1 with $('#div1'). now I want to search only in children of div1. How can I do it with jQuery?
Upvotes: 0
Views: 106
Reputation: 9847
$("#div1 input")
or
$("#div1 input[name=pattern]") // more than 1 input?
or
$("#div1 > input") // only direct child
and so on.
This implies you have to target precisely the div1
. A more general approach depends on what you do with the other divs.
Upvotes: 1