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