Disable pasting in a textbox using jQuery
- by Michel Grootjans
I had fun writing this one
My current client asked me to allow users to paste text into textboxes/textareas, but that the pasted text should be cleaned from '<...>' tags. Here's what we came up with:
$(":input").bind('paste', function(e) {
var el = $(this);
setTimeout(function() {
var text = $(el).val();
…