javascript - How to restrict the user from typing more than certain characters in a editable div or Iframe -


i have editable div , iframe. require user must not able type more 100 characters per line. user can enter infinite number of lines having maximum 100 characters.

also user can go line, using arrow keys , enter more text in case line had less 100 characters.

how perform this?

edit: needs in real time user types.

$('#mydivid').keypress(function(e){     if($(this).html().length > 20)         e.preventdefault(); }) 

fiddle


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -