Call Javascript function on “onkeyup” event of TextBox function valid(field) { var txt = document.getElementById(‘TextBox1′).value; var iChars = “!@$%^&*()+=-[]\\\’;,./{}|\”:?~_”; for (var i = 0; i < txt.length; i++) { if (iChars.indexOf(txt.charAt(i)) != -1) { alert(“Your string has special characters. \nThese are not allowed.”); document.getElementById(‘TextBox1′).value = txt.substring(0, txt.length – 1); return false; } } } function …
Textbox should not contain special character using JavaScript
