Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
选择除-jQuery之外的所有元素_Jquery_Select - Fatal编程技术网

选择除-jQuery之外的所有元素

选择除-jQuery之外的所有元素,jquery,select,Jquery,Select,我有以下代码: <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"> <

我有以下代码:

<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>

我想选择具有.form type textfield类的所有元素,但排除位于.inputs div中的元素。如何实现它?

好的,我得到了:

$('.contact-form .form-type-textfield').not('.undesirable-inputs .form-type-textfield');
使用
not()
排除选择器

$('.form-type-textfield').not('.undesirable-inputs .form-type-textfield')

老实说,如果你这么快就得到了解决方案……你真的没有在问问题之前做过研究