<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>[SOLVED]Remove Special Characters from the Textbox using JavaScript</title>
<script language="javascript" type="text/javascript">
function RemoveSpecialCharTest(txtNameTest) {
if (txtNameTest.value != '' && txtNameTest.value.match(/^[\w ]+$/) == null) {
txtNameTest.value = txtNameTest.value.replace(/[\W]/g, '');
}
}
</script>
</head>
<body>
<div>
<b>Enter Text:</b><input id="txtNameTest" type="text" onkeyup="javascript:RemoveSpecialCharTest(this)" />
</div>
</body>
</html>