Tuesday, April 2, 2019

javascript - jQuery selector regular expressions



I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.



I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is?



EDIT: The attribute filters allow you to select based on patterns of an attribute value.


Answer



James Padolsey created a wonderful filter that allows regex to be used for selection.




Say you have the following div:






Padolsey's :regex filter can select it like so:



$("div:regex(class, .*sd.*)")



Also, check the official documentation on selectors.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...