HTML5 textarea character limit attribute

Web_Designer picture Web_Designer · Apr 11, 2011 · Viewed 12.7k times · Source

Is there an HTML5 attribute to set the maximum amount of characters in a textarea or other form?
I want a yes/no answer not some other method using javascript.

Answer

penguinrob picture penguinrob · Apr 11, 2011

Yup, maxlength works still: http://jsfiddle.net/xhqsB/1/ (demo has textarea and input type of text)

Beware that it is fairly easy for the client to bypass these restrictions, so if you are submitting data to a form, have the server-side script check the length of the submitted data.