Javascript examples for String:search
Perform a case-sensitive search:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w ww . jav a 2s . c o m var str = "Blue blue red" var n = str.search("blue"); document.getElementById("demo").innerHTML = n; } </script> </body> </html>