开发者

how to exclude elements with ANY class attached in jquery

开发者 https://www.devze.com 2023-01-10 06:06 出处:网络
Does anyone know how i\'d exclude elements from a selection if they have any class whatsoever explicitly attached to them?

Does anyone know how i'd exclude elements from a selection if they have any class whatsoever explicitly attached to them?

Here i'm selecting all columns within the 'tdhead' element, but want to exclude anything I have ther开发者_运维百科e that's making use of another class, for example I might have a breadcrumb or toolbar as a single column across the top, in the tdhead.

_create: function () {
var self = this.element;
var headerColumns = self.children("thead").children("tr").children("td").not(".");

headerColumns.css("background-color", "Red");
}

So what's not working is the .not(".") part - whats the correct way to select (or not select) anything with any class?


.not("[class]")


var headerColumns = self.children("thead").find("td").not(".someClass1, .someClass2");

this will get all td's except those with class someClass1 or someClass2. Any question?

0

精彩评论

暂无评论...
验证码 换一张
取 消