Searching for Nodes with Specific Text using the Prototype Javascript Framework
- by Alan Storm
Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains()? If not, what would what be "The Prototype Way" to selector/filter-down a list of elements that contains a particular string.
For example, using the following
$$('#some_div dd a')
I may get back an array of 50 or so links. I only want the links that contain the work 'home'. In jQuery I'd do this
jQuery('#some_div dd a:contains('home')');
Is it possible to do something similar using Prototype? If not, is there an elegant way to filter out the array of 50 elements that gets returned.