jquery - limit how many characters can be pasted in textarea -


Is it possible to find out how many letters are being pasted in HTML text, and if cancel paste past the limit Go?

Edit: What I'm trying to do prevents users from pasting characters (~ 3 million) on a large scale because it crashes some browsers so that I can lock my browser First I want to cancel the paste. I am making a document editor where users can try it on. But they can type as much as they want.

You can do this on jQuery:

  $ ( Document) .ready (function () {function limits (obj, limit) {var text = $ (obj) .val (); var length = text.length; if (length & gt; border) {$ (obj) Val (text.substr (0, border));} else {// User warning of the remaining four. I have a warning here, but you can alert any other thing (boundary-lamp + "characters remaining!" )}} $ ('Textarea') keyboard (works () (limitations ($ (this), 20);})})  

See a demo.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -