我可以一次選擇不同類的元素嗎?在jquery中選擇不同類的元素
想,如果我有
<div id="divAdd">
<p style="font-size:16px; color:Blue; "></p>
<p class="test">
<input:textbox id="id1" type:"text" />
</p>
<p class="test">
<input id="txtMobile" type="text" style="width:120px;" name="txtMobile">
</p>
<p class="test">
<input id="txtMobile" type="text" style="width:120px;" name="txtMobile">
</p>
<p class="child">
<input id="txtMobile" type="text" style="width:120px;" name="txtMobile">
</p>
我可以選擇兩種不同類型的這樣所有的文本框?
$('#divAdd .test input:text, #divAdd .child input:text')
或者有更好的表現:
$('#divAdd .test input:text','#divAdd .child input:text').each(function() {
count++;
});
</div>