Hi,

how can i get password length on form in jquery?
I get the password with this:

var sifra=$("#input:password").val();

but when I want to check if password is entered and length is more than 6 characters, it
doesn't work:

if(! sifra){
			$("#sifra_p").show();
			$("#sifra_p").html("Niste unijeli šifru!");
			greska=1;
		}
		else{
			if(sifra.length < 6){
				$("#sifra_p").show();
				$("#sifra_p").html("Šifra mora imati bar 6 znakova!");
				greska=1;
			}
			else{
				$("#sifra_p").hide();
			}
		}

What could be a problem and what could be a solution. This kind of check works fine
for normally inputs (check, select etc).

Thanks in advance,

Amer

Aldm,

var sifra=$("input#password").val();
<input id="password" type="password" value="" />

Airshow

Thank you very much. I found somewhere on internet this code, but obviously it isn't correct.

Thanks once again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.