title: Hiding particular divs on selecting dropdown values in codeigniter
body: <p>Selecting dropdown value unable to hide particular divs.Hereis my code.</p>
  
  <p>View:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function showRequiredOption(cval)
   {
    if(cval=='interstate')
    {
     $('#cgst').hide();
     $('#sgst').hide();
     
    }
    else if(cval=='exemptedsales')
    {
     $('#cgst').hide();
     $('#sgst').hide();
     $('#igst').hide();
     
    }
    else
    {
     $('#igst').hide();
     $('#cgst').show();
     $('#sgst').show();
     
    }
   }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="col-md-9 col-md-offset-2"&gt;
   &lt;div id="legend"&gt;
    &lt;legend class=""&gt;Profile Information&lt;/legend&gt;
   &lt;/div&gt;  
      &lt;form role= action="&lt;?php echo site_url();?&gt;invoice/addinvoice" method="post" class="form-horizontal" id="location" method="post" accept-charset="utf-8"&gt;  
    &lt;div class="form-group"&gt;
     &lt;label class="control-label col-sm-2 " for="user"&gt;User&lt;/label&gt; 
     &lt;div class="col-sm-4 col-sm-offset-1"&gt;
      &lt;select id="user" name="user" onchange="showRequiredOption(this.value);"&gt;
       &lt;option value="employee"&gt;Local Sales&lt;/option&gt;
       &lt;option value="interstate"&gt;Inter state&lt;/option&gt;
       &lt;option value="freelancer"&gt;Stock transfers&lt;/option&gt;
       &lt;option value="exemptedsales"&gt;Exempted Sales&lt;/option&gt;
       &lt;option value="company"&gt;Zero Rated Sales&lt;/option&gt;
       &lt;option value="freelancer"&gt;Job Work&lt;/option&gt;
      &lt;/select&gt;
     &lt;/div&gt;
    &lt;/div&gt;  
    &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-2 " for="hsn"&gt;Freight Charges&lt;/label&gt;
      &lt;div class="col-sm-4 col-sm-offset-1"&gt;
     &lt;input type="text" class="form-control" id="hsn" placeholder="Enter HSN Number"  &gt;
      &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class="form-group" id="igst"&gt;
      &lt;label class="control-label col-sm-2 " for="hsn"&gt;IGST 18%&lt;/label&gt;
      &lt;div class="col-sm-4 col-sm-offset-1"&gt;
     &lt;input type="text" class="form-control" id="hsn" placeholder="Enter HSN Number"  &gt;
      &lt;/div&gt;
    &lt;/div&gt; 
     &lt;div class="form-group" id="sgst"&gt;
      &lt;label class="control-label col-sm-2 " for="hsn"&gt;SGST 9%&lt;/label&gt;
      &lt;div class="col-sm-4 col-sm-offset-1"&gt;
     &lt;input type="text" class="form-control" id="sgst" placeholder="Enter HSN Number"  &gt;
      &lt;/div&gt;
    &lt;/div&gt; 
    &lt;div class="form-group" id="cgst"&gt;
      &lt;label class="control-label col-sm-2 " for="hsn"&gt;CGST 9%&lt;/label&gt;
      &lt;div class="col-sm-4 col-sm-offset-1"&gt;
     &lt;input type="text" class="form-control" id="cgst" placeholder="Enter HSN Number"  &gt;
      &lt;/div&gt;
    &lt;/div&gt;   
        &lt;button id="submit" type="submit" class="btn" name="submit"&gt;Submit&lt;/button&gt;
       &lt;/form&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here if i select interstate,Stock Transfers in dropdown cgst,sgst should be hided and igst should be displayed.</p>
  
  <p>If i select Exempted sales,Zero Rated sales,Job Work in dropdown IGST,CGST,SGST should be hided.</p>
  
  <p>By default It should show sgst and cgst</p>