title: jQuery: How to show next section if the first section has completed with valid input
body: <p>I am new to programming. I have got an issue with my jquery codes.
  I have a form that I want to hide some sections of it and do not show until the first section which is input text, be completed then after clicking on the next button first check if all data inputs are completed then show the next section which is dropdown text (part2) and if I pick one of the dropdown text then show next section which is part3.</p>
  <p>I tried this code.</p>
  <pre><code>  &lt;script&gt;
      $(&quot;.part2&quot;).hide()
      $(&quot;.nextBtn&quot;).on(&quot;click&quot;, function(){
      $('input').each(function() { 
      if(!$(this).val()){ alert('Some fields are empty'); return false; }
      else{
      $(&quot;.part2&quot;).show();}
      
        });
      });
    &lt;/script&gt;
  
  
  
  
           &lt;div class=&quot;form&quot;&gt;
                 &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label&gt;First Name&lt;/label&gt;
                     &lt;input type=&quot;text&quot; class=&quot;input&quot; name=&quot;get[firstname]&quot;&gt;
                 &lt;/div&gt; &lt;br/&gt;
                 &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label&gt;Last Name&lt;/label&gt;
                     &lt;input type=&quot;text&quot; class=&quot;input&quot; name=&quot;get[lastname]&quot;&gt;
                 &lt;/div&gt; &lt;br/&gt;
                 &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label&gt;Email Address&lt;/label&gt;
                     &lt;input type=&quot;text&quot; class=&quot;input&quot; name=&quot;get[email]&quot;&gt;
                 &lt;/div&gt;
                 &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label&gt;Phone Number&lt;/label&gt;
                     &lt;input type=&quot;text&quot; class=&quot;input&quot; name=&quot;get[phone]&quot;&gt;
                 &lt;/div&gt;
  
                 &lt;button  class=&quot;nextBtn&quot;&gt;Next&lt;/button&gt;
  
                  &lt;section class=&quot;part2&quot;&gt;
                     &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label for=&quot;text&quot;&gt;Choose a text:&lt;/label&gt;
                     &lt;select name=&quot;text&quot; id=&quot;text&quot;&gt;
                         &lt;option value=&quot;1&quot;&gt;Text1&lt;/option&gt;
                         &lt;option value=&quot;2&quot;&gt;Text2&lt;/option&gt;
                     &lt;/select&gt;
                 &lt;/div&gt;
  
                 &lt;section class=&quot;part3&quot;&gt;
                     &lt;div class=&quot;inputfield&quot;&gt;
                     &lt;label for=&quot;text&quot;&gt;Choose a text:&lt;/label&gt;
                     &lt;select name=&quot;text&quot; id=&quot;text&quot;&gt;
                         &lt;option value=&quot;1&quot;&gt;Text1&lt;/option&gt;
                         &lt;option value=&quot;2&quot;&gt;Text2&lt;/option&gt;
                     &lt;/select&gt;
                 &lt;/div&gt;
  </code></pre>
  <p>Thanks.</p>