Javascript DOM HTML Input Email size Property set

Introduction

Change the width of an email field:

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

E-mail: <input type="email" id="myEmail">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from   ww w. j a  v  a  2  s.com*/
  document.getElementById("myEmail").size = "50";
}
</script>

</body>
</html>

The size property sets or gets the value of the size attribute of an email field.

The size attribute specifies the width of an email field.

The default value is 20.

The size property accepts and returns a number type value.

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




PreviousNext

Related