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

Javascript examples for DOM HTML Element:Input URL

Description

Input URL value Property - Get the URL 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 onclick="myFunction()">Test</button>

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

<script>
function myFunction() {/*from   w w w  .jav a  2  s  .c  o  m*/
    var x = document.getElementById("myURL").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials