Q:

My else if statement is giving syntax error

window.setInterval(function(){

var value = $("#pizzaNumber").val();

if (value=0) {

document.getElementById('type2').style.display = 'none';

document.getElementById('type3').style.display = 'none';

{

else if (value=2) {

document.getElementById('type2').style.display = 'block';

}

else if (value=3) {

document.getElementById('type2').style.display = 'block';

document.getElementById('type3').style.display = 'block';

}

else {

document.getElementById('type2').style.display = 'none';

document.getElementById('type3').style.display = 'none';

alert("Invaild Number Entered");

}

}, 2000);

A:

Your first if statement is closed by a { instead of a }. That's what's causing your syntax error. However, as David said, you should be comparing using == or ideally === instead of =. A single = is assignment, not comparison.

