Javascript examples for DOM Event:addEventListener
The onsearch event occurs when a user presses the "ENTER" key or clicks the "x" button in an <input> element with type="search".
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <input type="search"> |
<!DOCTYPE html> <html> <body> <input type="search" id="myInput"> <p id="demo"></p> <script> document.getElementById("myInput").addEventListener("search", myFunction); function myFunction() {// www. j a v a 2s . co m var x = document.getElementById("myInput"); document.getElementById("demo").innerHTML = "You are searching for: " + x.value; } </script> </body> </html>