Javascript examples for DOM HTML Element:Input Email field
The size property sets or gets the size attribute of an email field, which controls the width of an email field.
The default value is 20.
Set the size property with the following Values
Value | Description |
---|---|
number | Sets the width of the email field, in number of characters. |
A Number, representing the width of the email field, in number of characters
The following code shows how to change the width of an email field:
<!DOCTYPE html> <html> <body> E-mail: <input type="email" id="myEmail" size="30"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w w w .ja v a 2s.c o m document.getElementById("myEmail").size = 10; } </script> </body> </html>