Try this
$('#txtname').bind('keypress', function (event) {
var regex = /[!`~:;"'\^*%${}[\]#&())_?\\<>+/|]/gi;
var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
if (regex.test(key)) {
event.preventDefault();
return false;
}
}).bind('paste', function (event) {
var el = $(this);
setTimeout(function () {
var regex = /[!`~:;"'\^*%${}[\]#&())_?\\<>+/|]/gi;
var text = $(el).val();
if (regex.test(text)) {
$(el).val('');
return false;
}
}, 100);
});