0

I have a text area which doesn't have max length. In that text area i am restricting the symbols and junk characters on keypress by checking with charcode>160 and able to restrict the junk symbols and characters. But when i trying to stop copy pasting the junk values, it does n't happen. Below I have copied the code which i tried for keypress and copy paste.

$("input[type=text], textarea").bind("keypress paste", function(event) {
        if (event.charCode>160 || !event.charCode) {
            alert("Not allowed characters/symbols");
            event.preventDefault();
        }
})

and some junk characters -- !íßÓÜØúƤ etc.

GMan
  • 119
  • 12

0 Answers0