Javascript examples for DOM HTML Element:Input Search
The type property returns the type of form search field.
For a search field, this property will always return "search".
A String, representing the type of form element the search field is
The following code shows how to return which type of form element the search field is:
<!DOCTYPE html> <html> <body> Search: <input type="search" id="mySearch"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w ww . java 2s .c o m var x = document.getElementById("mySearch").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>