Skip to content

Instantly share code, notes, and snippets.

@Irfan-Ansari
Created February 12, 2014 08:54
Show Gist options
  • Save Irfan-Ansari/8952066 to your computer and use it in GitHub Desktop.
Save Irfan-Ansari/8952066 to your computer and use it in GitHub Desktop.
Jquery Selector by data attributes
// Select by specific element type, attribute and value
$("div[data-myattr='myvalue']").doSomething();
// Select by specific element type and attribute
$("div[data-myattr]").doSomething();
// Select by specific attribute
$('[data-myattr]').doSomething();
// See more: http://api.jquery.com/contains-selector/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment