Javascript examples for DOM HTML Element:Input URL
The size property sets or gets the size attribute of a URL field, which sets the width of an URL field.
The default value is 20.
Set the size property with the following Values
Value | Description |
---|---|
number | Sets the width of the URL field, in number of characters. Default value is 20 |
A Number, representing the width of the URL field, in number of characters
The following code shows how to change the width of a URL field:
<!DOCTYPE html> <html> <body> Homepage: <input type="url" id="myURL" size="30"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*ww w.j av a2 s .co m*/ var x = document.getElementById("myURL").size; document.getElementById("demo").innerHTML = x; } </script> </body> </html>