<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 id="demo"></p>
<script>
function myFunction() {
let x = document.getElementById("myURL").form.id;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>