+ 5

What is difference between "size" and "maxlength" attribute of <input> element....?

Are they used for same purpose...

10th Sep 2018, 1:42 PM
Satyendra Singh
Satyendra Singh - avatar
3 Answers
+ 13
size - sets the width of the input based on characters. For example, I'll set the size to 30, the width of an input will be adjusted where it can fit 30 characters in a textbox but you can still type texts above 30 characters maxlength - sets the maximum characters inside an input. For example, I'll set the maxlength to 10, you can only type 10 characters and would prevent you to type if it reached 10 characters.
10th Sep 2018, 2:09 PM
Email Not Activated
+ 4
Satyendra Singh Yes, it reflects the width size of the textbox.
12th Sep 2018, 6:23 AM
Email Not Activated
0
Sleepy Koala mean to say size is for defining the width of rectangular box...?
10th Sep 2018, 2:13 PM
Satyendra Singh
Satyendra Singh - avatar