I need to find a text from a paragraph using java script. Is there any code in JavaScript like we do in c# to find a text using "string.Contains("")" method.
Pls help...
Thanks Guys..
You can use str.search()
It will return the position of match and -1 if not found
equivalent of string.Contains("") is indexOf (returns -1 if subString doesnt exist in a string).
you can do :
var myString = "foo";
var myParagraphText = $('#myParagraphId').text();
if(myParagraphText.indexOf(myString) != -1){
//myParagraphText contains myString
}