Input URL size Property - Display the width of a URL field (in number of characters): - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL

Description

Input URL size Property - Display the width of a URL field (in number of characters):

Demo Code

ResultView the demo in separate window

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

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

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

<script>
function myFunction() {//from www .  j a  va 2 s. c  o m
    var x = document.getElementById("myURL").size;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials