I have JavaScript code to check if special characters are in a string. The code works fine in Firefox, but not in Chrome. In Chrome, even if the string does not contain spec
Try This one.
function containsSpecialCharacters(str){ var regex = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/g; return regex.test(str); }