Get the default value of a search field:
var x = document.getElementById("mySearch").defaultValue;
Click the button to display the default value of the search field.
<!DOCTYPE html> <html> <body> Search: <input type="search" id="mySearch" value="Food"> <button type="button" onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w w w. j av a 2 s . c o m var x = document.getElementById("mySearch").defaultValue; document.getElementById("demo").innerHTML = x; } </script> </body> </html>