Get Input URL Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL


The Input URL object represents an HTML <input> element with type="url".

You can access an <input> element with type="url" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<input type="url" id="myURL" value="">

<button onclick="myFunction()">get the URL of the URL field</button>

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

function myFunction() {//from   w ww  .  ja  v a2  s .c o m
    var x = document.getElementById("myURL").value;
    document.getElementById("demo").innerHTML = x;


Related Tutorials