Tag Archives: jQuery

Using jQuery selector to search content with filter startswith

Add filter to jQuery

 $.expr[":"].startsWith = function(el, i, m) {
     var search = m[3];
     if (!search) return false;
     return eval("/^[/s]*" + search + "/i").test($(el).text());
 };

Using filter

$('p:startsWith("hello")').text();

Thanks: http://west-wind.com/Weblog/posts/519980.aspx