Created
October 12, 2012 19:12
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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