i have a username text field in the login.html file i have node.js code as follows
loginbtn.addEventListener("click", function(){
if(username.value != null){
socket.emit("login", {username:username.value});
$("#name").hide();
$("#mario-chat").show();
}
else{
err.innerHTML = document.write("please enter username")
}
});
in the login page i have not entered any name but still my code goes to the if condition and executing the $("#name").hide();$("#mario-chat").show();. please tell me why my if condition is executing rather than else part. thanks in advance.
Aucun commentaire:
Enregistrer un commentaire