12" />
开发者

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');
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜