Created
February 23, 2016 22:20
-
-
Save andyvanee/d6c171e59d63af1f6e84 to your computer and use it in GitHub Desktop.
Select by matching an ID with a regex
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
// Select by matching id with a regex | |
// eg: $('select:regex("box.*-layout")') | |
jQuery.expr[':'].regex = function(elem, index, args) { | |
var regex = new RegExp(args[3], 'i'); | |
return elem.id.match(regex); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment