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(', #')); 

js fiddle demo.

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'); 

js fiddle demo.

references:


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -