vendredi 18 décembre 2020

second and third Else block never get called even if condition satisfying

button in JAvaScript function validate(){ var uname=document.getElementById("username"); var passwd=document.getElementById("pass"); if(uname.value.trim()=="" ){ alert("Blank Username not allowed"); return false; }else if(passwd.value.trim()==""){ alert("Blank password not allowed"); return false; }else if(passwd.value.trim().length()
<body> 
    <form onsubmit="return validate();" action="message.html"> 
        <input id="username" type="text" placeholder="Username">
        <br><br>

        <input id="=pass" type="password" placeholder="Password"> 
        <br>
        <br>
        
        <button type="submit">Submit</button>
    </form>
</body>

Aucun commentaire:

Enregistrer un commentaire