Skip to content

Instantly share code, notes, and snippets.

@bradparks
Created October 12, 2012 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradparks/3880920 to your computer and use it in GitHub Desktop.
Save bradparks/3880920 to your computer and use it in GitHub Desktop.
how to find which elements in a page have a background image matching some substrings using jquery
// finds elements that have the keywords 'blue' and 'ajax' in their background-image url
$('*').filter(function() {
var p = $(this).css('background-image');
var success = true;
success &= p.indexOf('blue') != -1;
success &= p.indexOf('ajax') != -1;
if (success)
{
console.log(p);
}
return success;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment