views:

54

answers:

2
       var a="password";

In any variable how to check if the length is not less than 6 characters and not > 12

     $(a).len();?????
+6  A: 

No need for jQuery.

if ((a.length < 6) || (a.length > 12)) { error .... }

MDC reference on string.length

MDC reference on the String object

Pekka
A: 
if (a.length < 6 || a.length > 12) {
    alert('Invalid password. It must be between 6 and 12 characters long');
}
Darin Dimitrov