1

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.

Web_Designer
  • 68,768
  • 89
  • 200
  • 259

2 Answers2

2

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.

penguinrob
  • 1,423
  • 3
  • 16
  • 39
0

see: textarea – text input area - HTML5

the maxlength attribute is new to HTML5 for <textarea> but has been available for <input type="text" /> for a while

see other similar questions:

jquery - TextArea MaxLength - Supported or Not Supported? - Stack Overflow

How to impose maxlength on textArea in HTML , Javascript - Stack Overflow

Community
  • 1
  • 1
MikeM
  • 26,727
  • 4
  • 62
  • 80