[jQuery] Select all controls of the form
I am trying to validate all the controls that exist in the form. My
form code looks like:
<form id="form1">
<input type="text" id="txt1" name="txt1" />
<br/>
<textarea name="txtArea" id="txtArea" cols="100" rows="4" />
<br/>
<select id="sel1" name="sel1" style="width: 250px;" >
<option value="">Select</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<br/>
<input type="radio" id="rdo1" name="rdo1"
value="Option1"> Option 1
<br/>
<input type="radio" id="rdo2" name="rdo1"
value="Option2"> Option 2
<br/>
<button id="btn1">Submit</button>
<button id="btn2">Reset</button>
</form>
I want to select only the controls of the form viz: textbox, textarea,
select, radio & button (Total 7). I am trying to extract them as
$("#form1 *").each(function() {
alert($("#+this").attr("id"));
})
it gives me total 16 alerts. I want just 7. Any help..?