jquery problem with simple code
- by moustafa
why this code is not working
var name = $("#name").val();
var email = $("#email").val();
var web = $("#web").val();
var comment = $("#comment").val();
if(name.length < 5){
$("#name").css("border-color","red");
} elseif (email.length < 5) {
$("#email").css("border-color","red");
} elseif (web.length < 5) {
$("#web").css("border-color","red");
} elseif (comment.length < 10) {
$("#comment").css("border-color","red");
}else{
alert('ok');
}
and each val for one like this <input id="name" type="text" size="24" />