jquery problem with simple code

Posted by moustafa on Stack Overflow See other posts from Stack Overflow or by moustafa
Published on 2010-04-25T06:15:41Z Indexed on 2010/04/25 6:23 UTC
Read the original article Hit count: 292

Filed under:

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" />

© Stack Overflow or respective owner

Related posts about jQuery