Input URL type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL

Description

The type property returns the type of form URL field.

For an input type="url", it will always return "url".

Return Value

A String, representing the type of form element the URL field is

The following code shows how to return which type of form element the URL field is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Homepage: <input type="url" id="myURL">

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

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

<script>
function myFunction() {/* w  w  w  .j ava2 s  .  com*/
    var x = document.getElementById("myURL").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials