jquery selector for all elements except attributes in an array -
i have page array:
var idlist = ['id1', 'id2', 'id3'];
this array references <div>
s in html ids. each of these <div>
s has class .tabpage
.
i'm trying write selector targets div.tabpage
elements, except ones id in array. found .not()
function in jquery documentation, how can multiple values?
i'd suggest:
$('div.tabpage').not('#' + idlist.join(', #'));
if prefer more verbose approach, instead use filter (which either remove, or retain, elements selection):
$('div.tabpage').filter(function(){ return idlist.indexof(this.id) === -1; }).addclass('jqueryfound');
references:
Comments
Post a Comment