Javascript DOM HTML Input URL size Property set

Introduction

Change the width of a URL field:

document.getElementById("myURL").size = "50";

Click the button to set the width of the URL field.

elements with type="url" are not supported in Safari.

View in separate window

<!DOCTYPE html>
<html>
<body>

Homepage: <input type="url" id="myURL">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {/*from ww w. j  a va2  s.  co m*/
  document.getElementById("myURL").size = "50";
}
</script>

</body>
</html>

The size property sets or gets the value of the size attribute of a URL field.

The size attribute specifies the width of an URL field in number of characters.

The default value is 20.

The size property returns a Number representing the width of the URL field, in number of characters.




PreviousNext

Related