Home » Javascript » Else block not fulfilling my condition

Else block not fulfilling my condition

Posted by: admin June 30, 2018 Leave a comment

Questions:
if(a == 1 || b == 0) {
    document.getElementById("div").style.display = "none";
}
 else {
    document.getElementById("div").style.display = "block";
 }

When I select a value 1 or b value 0 my div style set to none because condition is true, but when I select a value 2 or b value 3 means anything except 1 or 0 my div is not showing it’s in display: none, it needs to display block.

Can you guyz know what I am doing wrong here?

Answers: