Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery .search() to any string

I saw this code snippet:

$("ul li").text().search(new RegExp("sometext", "i"));

and wanted to know if this can be extended to any string?

I want to accomplish the following, but it dosen't work:

$("li").attr("title").search(new RegExp("sometext", "i"));

Also, anyone have a link to the jQuery documentation for this function? I fail at googling apparently.

like image 758
Omar Avatar asked Dec 06 '09 06:12

Omar


1 Answers

if (str.toLowerCase().indexOf("yes") >= 0)

Or,

if (/yes/i.test(str))
like image 198
Biswajit Roy Avatar answered Sep 24 '22 02:09

Biswajit Roy