Created
February 7, 2019 21:19
-
-
Save ugommirikwe/b96684a41b1ea7eda8d653f4648c9da8 to your computer and use it in GitHub Desktop.
Utility Javascript function to check if a provided value is a valid CSS selector string.
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
function isValidCssSelector(selector) { | |
var re = /^[A-Za-z]+[\w\-\:\.]*$/ | |
return re.test(id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment