Peter Pik
Peter Pik

Reputation: 11193

textarea html5 validation with minimum number of characters

I've created a form with below textarea, however when i try to do a simple validation with pattern, title and required it does not seem to work. it show the small pop up window if the textarea is empty, but it does not show it with the title if below 30 charachters? do this not work on textarea or what am i doing wrong?

<textarea name="textarea" id="description" value="" placeholder="Beskrivelse" required="required" pattern=".{30,}"  title="30 characters minimum"></textarea>

Upvotes: 1

Views: 429

Answers (1)

thepio
thepio

Reputation: 6253

Have you taken a look at the attribute minlength? As of setting the attribut minlength="30" to the textarea.

<textarea name="textarea" id="description" value="" placeholder="Beskrivelse" required="required" minlength="30"  title="30 characters minimum"></textarea>

Upvotes: 1

Related Questions