I've seen the same thing enough times now that it's sparked my curiosity. It's even on this site!
The <input id=title ... >
element on the "https://stackoverflow.com/questions/ask" sets maxlength=300
and data-max-length="150"
.
Namely, the input box will allow you to type 300 characters into it, but the form will not accept anything above 150.
Is there a reason one might do this?
答案 0 :(得分:1)
It's most likely to prevent user from loosing end of the text while not noticing that input is limited or when pasting. After getting an error user can edit input while text is intact.