Jquery 如何检查文本框是否有';x';阶级与否

Jquery 如何检查文本框是否有';x';阶级与否,jquery,html,Jquery,Html,我的div中有很多文本框。我只想知道没有x类的文本框不是空的。 我怎样才能做到这一点 我试过: $("div.editorRow input").each(function () { //I want to check here if Textbox class is not x. if (!$(this).val()) { } } 请帮帮我。我不知道怎么做。请尝试以下方法: $("div.editorRow input").each(function () { if

我的div中有很多文本框。我只想知道没有
x
类的文本框不是空的。 我怎样才能做到这一点

我试过:

$("div.editorRow input").each(function () {
   //I want to check here if Textbox class is not x.
   if (!$(this).val()) {
   }
}
请帮帮我。我不知道怎么做。

请尝试以下方法:

$("div.editorRow input").each(function () {
   if (! (this.value && $(this).is('.x') ) {
       // do stuff
   }else{
       // do other stuff
   }
}
if(!$(this).hasClass('x')){
}
你可以做:

$("div.editorRow input:not(.x)").each(function () {
    if (this.value == '') {
        console.log("im empty!);
    }
});

这是一个非常基本的问题。“始终有用”中提供了足够的信息,我建议您从这里开始。出于好奇,为什么
is
vs
hasClass
?@JamesMontagne-
hasClass()
速度更快(略快),但我只想使用
is()
,因为它适用于所有东西?它实际上是
输入:不是(.x)
如果我理解正确的话。@JamesMontagne——读得太快了!固定:)