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;
}
}
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;
}
}
Also in JavaScript:
- javascript find prime number
- array matching
- react native hide scroll indicator
- javascript async await returns undefined
- mongoose reference another model
- javascript tutorialspoint
- javascript lookahead
- adding cors parameters to extjs ajax
- javascript preencher array com 0
- how to call function from another js file in react native
- check checkbox by jquery
- .on change get value
- if typeof equals array javascript
- expresiones ternarias javascript
- js replace quotes
- loop through map in js
- how get parent element javascript
- js if char in string
- javascript in jsx
- redirect browser javascript
- react native init specific version
- javascript global function
- how to get the height of window in javascript
- how to return character associated to character code javascript