How to handle nested each with input type in Jquery
I tried to look after a similar problem but couldn't find any here. So here is my problem. I have a structure with multiple div. Each div have a class name 'testClass'. I need to fetch the attributes of all input types, button.
Here is my code,
<body>
<div class="testClass">
/* Few Code */
<input type="text" id="txt1" /> <br/>
<input type="text" id="txt21" />
/* Few Code */
<button id="btn1">Button1</button>
</div>
<div class="testClass">
/* Few Code */
<input type="text" id="txt2" /> <br/>
<input type="text" id="txt22" />
/* Few Code */
<button id="btn2">Button2</button>
</div>
<div class="testClass">
/* Few Code */
<input type="text" id="txt3" /> <br/>
<input type="text" id="txt23" />
/* Few Code */
<button id="btn3">Button3</button>
</div>
</body>
I have tried following
$("div .testClass").each(function() {
/* Some code present */
$(this).find('input,button').each(function(){
});
});
but it is not working. How can i select input types from div class testClass after the first each statement.
Could you help? Thanks.