title: Onchange Event of Select Box
body: <p>I am using an <code>onchange event of select box</code> with jquery.
  On change I have given <code>display property = none</code> in other div.
  Problem is that when I got data from database and set it in select box so <code>onchange</code> property is not applied for given value. Why?
  My code</p>
  
  <pre><code>&lt;select id="patientType" name="Patient_Type"&gt;
  &lt;option value=""&gt;--SELECT--&lt;/option&gt;
  &lt;option value="OPD"&gt;OPD&lt;/option&gt;
  &lt;option value="IPD"&gt;IPD&lt;/option&gt;
  &lt;/select&gt;
  &lt;div id="roomInfo" clasas="inactive"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Script</p>
  
  <pre><code>$('#patientType').change(function() {
   if ($('#patientType').val() == 'IPD') {
    if ($('#roomInfo').hasClass('inactive')) {
     $('#roomInfo').removeClass('inactive');// CSS Property Display None in this class
     $('#roomInfo').addClass('active');
    }
   } else {
    if ($('#roomInfo').hasClass('active')) {
       $('#roomInfo').removeClass('active');
       $('#roomInfo').addClass('inactive');
      }
   }
  });
  </code></pre>
  
  <p>now i got data From database and set it this select patientType
  $('#patientType').val(data fetch From the database);
  can not apply onchange event apply and not display my roomInfo div
  so it is possible or not .
  or another method for getting that method.
  Please help.
  Thanks In Advance.</p>