Javascript Reference - HTML DOM Input URL type Property








The type property returns the type of the URL field.

Browser Support

type Yes 10.0 Yes Yes Yes

Syntax

var v = urlObject.type

Return Value

A String type value representing the type of the URL field.





Example

The following code shows how to get the type of the URL field.


<!DOCTYPE html>
<html>
<body>
<!-- w ww .j a  v a 2s. co m-->
Homepage: <input type="url" id="myURL">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
    var x = document.getElementById("myURL").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: