-2

div 内に多くのテキストボックスがあります。xクラスのないテキストボックスが空ではないことを知りたいだけです。これどうやってするの。

私が試してみました:

$("div.editorRow input").each(function () {
   //I want to check here if Textbox class is not x.
   if (!$(this).val()) {
   }
}

私を助けてください。これを行う方法がわかりません。

4

3 に答える 3

6

以下を試してください:

if(!$(this).hasClass('x')){
}
于 2013-06-06T14:23:09.003 に答える
3
$("div.editorRow input").each(function () {
   if (! (this.value && $(this).is('.x') ) {
       // do stuff
   }else{
       // do other stuff
   }
}
于 2013-06-06T14:23:02.753 に答える
3

できるよ:

$("div.editorRow input:not(.x)").each(function () {
    if (this.value == '') {
        console.log("im empty!);
    }
});
于 2013-06-06T14:24:11.637 に答える