Created
January 10, 2013 14:22
-
-
Save dedg3/4502356 to your computer and use it in GitHub Desktop.
Filter Objects by data attribute value
This file contains hidden or 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
/* | |
<div id="proto_1" data-state="open">Div 1 - proto open</div> | |
<div id="">Div 2</div> | |
<div id="proto_3" data-state="closed">Div 3 - proto closed</div> | |
<div id="proto_4" data-state="open">Div 4 - proto open</div> | |
*/ | |
var $el = $('div[id^=proto_]').filter('div[data-state=open]').css('color','red'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment