1

我正在使用表格遍历 $("table").each(function()

如何跳过具有 css 类“ NotThisClass ”的表

$("table").each(function(){
  if( $(this:not('.NotThisClass')))
    {
      // Do Stuff
    }
  }

不工作,也不是这个,

if( $(this).not('.NotThisClass'))

什么是正确的语法?

4

3 回答 3

7
$("table").not('.NotThisClass').each(function() {
    //Do your stuff!
});
于 2012-05-17T18:20:12.133 回答
4

试试这个:

$("table:not(.NotThisClass)").each(function ()
{
  // Do Stuff
});
于 2012-05-17T18:23:03.883 回答
1
$("table").each(function(){
  if(!$(this).hasClass('NotThisClass')))
    {
      // Do Stuff
    }
  }
于 2012-05-17T18:22:06.230 回答