I have this code:
<div class="contact-form">
<input class="form-type-textfield name" />
<input class="form-type-textfield surname" />
<input class="form-type-textfield address" />
<div class="undesirable-inputs">
<input class="form-type-textfield one" />
<input class="form-type-textfield two" />
<input class="form-type-textfield three" />
</div>
</div>
I'd like to select all elements with .form-type-textfield class but exclude those which are located in .undesirable-inputs div. How can I achieve it?
使用not()
排除选择器
$('.form-type-textfield').not('.undesirable-inputs .form-type-textfield')
好,我知道了:
$('.contact-form .form-type-textfield').not('.undesirable-inputs .form-type-textfield');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.