I currently have the following jQuery snipplet that will find images in a specific div and exclude ones with a specific class:
var postImgs = $('#primary img');
var classes = new Array(".skip", ".block", ".ignore");
postImgs.each(function (){
if(!$(this).is(classes.join(", "))) {
//Do Something
}
});
What I also need to do is check for specific file names to not apply the function to either. So I tried something… but it didn’t work:
postImgs.not('img[src$="uniquefile.jpg"]').each(function (){ }
Even then, I would much rather prefer to be able to provide an array of file names, like I can with my classes .
So how can I also specify an array of file names to skip, in addition to keeping the classes filter I am already employing? That way I can just do something like this:
var fileNames = new Array("uniquefile.jpg", "somename.png", "anotherfile.gif");
You can do something like this in the selector
http://jsfiddle.net/DF9rx/