<form id="test">
<input type="text" name="title" value="I am title">
<div id="text1">
<input type="text" name="module-title" value="I am module title">
</div>
<div id="test2">
<input type="text" name="article-title" value="I am article title">
</div>
</form>
How do I select by jquery all the form (i.e. #test) input fields, except all the input fields which are inside "#test2".
Try
$('#test input:text').not('#test2 input:text')
$('#test :input:not(#test2 :input)')
:input
is a special pseudo-selector which matches all input elements, like input
, select
and textarea
.
JSFiddle: http://jsfiddle.net/vudS3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With