title: How to use nested if else in Jquery Javascript
body: <p>What I'm trying to do here is have a form validation. I have 3 element here, a,b and c.</p>
  
  <p>What I need to do is:</p>
  
  <p>Edit: Just to correct my question</p>
  
  <p><strong>If a != 0 || a != '' validation_holder = 1;</strong></p>
  
  <p><strong>else, if var a has value greater than zero, compare the value of b and c, c should not greater than b</strong></p>
  
  <p>if no errors submit the form.</p>
  
  <p>I'm trying to do this in nested if else.</p>
  
  <p>And here's what I have right now. <a href="http://jsfiddle.net/jWL9s/2" rel="nofollow">http://jsfiddle.net/jWL9s/2</a></p>
  
  <p>Any help will appreciate.</p>
  
  <pre><code>&lt;form action="" method="post" id="register_form"  name="register_form"&gt;
  PO&lt;input type="text" id="a" value="0"/&gt;&lt;br/&gt;
  Remain&lt;input type="text" id="b" value="10"/&gt;&lt;br/&gt;
  PR&lt;input type="text" id="c" value="5"/&gt;&lt;br/&gt;
  &lt;span class="alert"&gt;&lt;/span&gt;
  &lt;input name="edt_submit" type="submit" value="Edit"&gt;
  &lt;/form&gt;
  
  jQuery(function($) {
  var validation_holder;
  
  $("form#register_form input[name='edt_submit']").click(function() {
  
  var validation_holder = 0;
  
      var a           = $("form#register_form input[id='a']").val();
      var b           = $("form#register_form input[id='b']").val();
      var c           = $("form#register_form input[id='c']").val();
  
      if(a != 0 &amp;&amp; a != '') {
          $("span.alert").html("You Cannot edit").addClass('validate');
          validation_holder = 1;
      } else {
      if( b &gt; c ) {
          $("span.alert").html("Value is Greater than").addClass('validate');
          validation_holder = 1;
          } else {
          $("span.alert").html("");
          }
      }
  
      if(validation_holder == 1) { // if have a field is blank, return false
          $("p.validate_msg").slideDown("fast");
          return false;
      }  validation_holder = 0; // else return true
      /* validation End */    
  }); // click End 
  
  }); // jQuery End
  </code></pre>