Ok so I have an HTML input element
<input name="name" type="text" id="name" placeholder="Name" />
and in JavaScript I do :
var ninp = document.getElementById("name");
if(ninp.value == ""){
do stuff
} else{
do other stuff
}
Everytime I run the function it fires the "else" block of code I'm I doing something wrong or this isnt a correct way :/
if(ninp == "")because you're already grabbing thevaluein the first line.