In javascript, I want to have an if else statement that will change an elements value(a text field in an html form) to zero if nothing is typed in. I had the following:
if(document.getElementById('dollarinput').value == null){
var dollars = 0;
}
else{
var dollars = parseInt(document.getElementById('dollarinput').value);
}
Something isn't working correctly in the if condition, but I'm not sure what I did wrong.