Searching for Nodes with Specific Text using the Prototype Javascript Framework

Posted by Alan Storm on Stack Overflow See other posts from Stack Overflow or by Alan Storm
Published on 2010-06-09T03:45:11Z Indexed on 2010/06/09 3:52 UTC
Read the original article Hit count: 263

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about prototype