Number of characters in a string
var a=开发者_如何学运维"password";
In any variable how to check if the length is not less than 6 characters and not > 12
$(a).len();?????
No need for jQuery.
if ((a.length < 6) || (a.length > 12)) { error .... }
MDC reference on string.length
MDC reference on the String object
if (a.length < 6 || a.length > 12) {
alert('Invalid password. It must be between 6 and 12 characters long');
}
精彩评论