remove special characters from string javascript
var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"
remove special characters from string javascript
var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"
how to block special characters in javascript
var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
for (var i = 0; i < document.formname.fieldname.value.length; i++) {
if (iChars.indexOf(document.formname.fieldname.value.charAt(i)) != -1) {
alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again.");
return false;
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us