Edit This Code:
<!DOCTYPE html>
<html>
<body>

<form id="myForm">
  Homepage: <input type="url" id="myURL">
</form>

<p>Click the button to display the id of the form the url field belongs to.</p>

<button onclick="myFunction()">Try it</button>

<p><strong>Note:</strong> elements with type="url" are not supported in IE 9 (and earlier), or Safari.</p>

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

<script>
function myFunction() {
    var x = document.getElementById("myURL").form.id;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy