如何从我的jQuery选择器中排除一个类?

我有以下代码:

$(":input[type='text']").wijtextbox(); 

我想要的是wijtextbox()如果我的文本框的类是本机的,则不应用。 有没有办法可以通过添加到上面的选择器以某种方式排除这个?

将其设为wijtextbox:

  

不要把它变成wijtextbox:

  

这个:

 $("input[type='text']").not(".native").wijtextbox(); 

或这个:

 $("input[type='text']:not('.native')").wijtextbox(); 

应该做的伎俩。 还有一个快捷方式,用于选择类型为text的输入:

 $("input:text").not(".native").wijtextbox(); 

更多关于not() 这里 。

编辑:因为看起来您需要选择textarea,请尝试以下方法:

 $("textarea").not(".native").wijtextbox(); 

试试这个。

 $(":input:not(.native)").wijtextbox(); 

由于您选择textarea您甚至可以使用它

 $("textarea:not(.native)").wijtextbox(); 

:not(selector) – 选择与给定选择器不匹配的所有元素。

您可以使用jQuery的.not()选择器,如下所示: http : //api.jquery.com/not/

你将如何使用它将取决于你想要找到的具体内容。