Input URL maxLength Property - Set the maximum number of characters allowed in a URL field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input URL

Description

Input URL maxLength Property - Set the maximum number of characters allowed in a URL field:

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() {// ww w  . j av a  2s  .  c  o m
    document.getElementById("myURL").maxLength = "8";
    document.getElementById("demo").innerHTML = "set";
}
</script>

</body>
</html>

Related Tutorials