title: nested if else in javascript
body: <p>I have trouble with the nested if structure in javascript. Any help is appreciated.</p>
  
  <pre><code>function validateForm()
  {
      var a = document.forms["demo1"]["addr1"].value;
      var b = document.forms["demo1"]["city"].value;
      //var c = document.forms["demo1"]["fname"].value;
      //var d = document.forms["demo1"]["lname"].value;
      //var f = document.forms["demo1"]["phno"].value;
      //var g = document.forms["demo1"]["email"].value;
      //var g1 = document.forms["demo1"]["cemail"].value;
      //var h = document.forms["demo1"]["pwd"].value;
      //var h1 = document.forms["demo1"]["cpwd"].value;
      if(b=="" || b==null)
      {
        alert("Please enter your city");
        return false;
        break;
      }
      else if(a=="" || a==null)
          {
              alert("Please enter your address");
              return false;
              break;
          }
      else {return true;} 
  }
  
  &lt;form name = "demo1" action = "exp2.php" onsubmit = "return validateForm()" method = "POST"&gt;
  </code></pre>
  
  <p>The code works fine(as intended) if there is only one if statement. But I am not getting the intended result if more than one if else is been deployed. </p>
  
  <p>Regards,
  Mani</p>