jQuery Content RegExp Selector
One of jQuery’s best features is the ease with which it can be extended with simple plugins. This post on customizing jQuery selectors inspired me to write the following selector extension, which matches text content in the current element set with a regular expression. Remember how I said it was simple? More like effortless, you could easily squeeze this down into a half dozen lines or so if you were so inclined. The only slightly difficult bit is figuring out what the “a”, “i” and “m” parameters mean in the jQuery selector source. From the looks of things “a” is the element to match, “i” is the index in the list of matched elements, and “m” is the regexp match for the selector expression where “m” is the value of the parameter supplied to the selector function.
About this entry
You’re currently reading “jQuery Content RegExp Selector,” an entry on spacebeast
- 16.12.08 / 9pm