Test if string is alphanumeric in Javascript
function isAlphaNum(alphane) { var numaric = alphane; for(var j=0; j<numaric.length; j++) { var alphaa = numaric.charAt(j); var hh = alphaa.charCodeAt(0); if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123)) { } else { return false; } } return true; }
This Javascript function tests, if a given string consists only of alphanumeric characters.
Most popular snippets