Javascript examples for DOM HTML Element:Input Search
The Input Search object represents an HTML <input> element with type="search".
You can access an <input> element with type="search" by using getElementById():
<!DOCTYPE html> <html> <body> <input type="search" id="mySearch" placeholder="Search for something.."> <button onclick="myFunction()">get the placeholder text of the search field</button> <p id="demo"></p> <script> function myFunction() {//from w ww. j a v a 2 s. com var x = document.getElementById("mySearch").placeholder; document.getElementById("demo").innerHTML = x; } </script> </body> </html>