Input URL defaultValue Property - Get the default value of a URL field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL

Description

Input URL defaultValue Property - Get the default value of a URL field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Homepage: <input type="url" id="myURL" value="http://www.google.com">

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from   www  .j  a v a  2  s .com
    var x = document.getElementById("myURL").defaultValue;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials