title: How to trigger jQuery change event in code
body: <p>I have a change event that is working fine but I need to get it to recurse.</p>
  <p>So I have a function that is triggered on change that will &quot;change&quot; other drop downs based on a class selector (notice &quot;drop downS&quot;, there could be more than one). This proxy change does not trigger the function and so fails. How can I get it to work?</p>
  <h3>Code</h3>
  <pre><code>$(document).ready(function () {
      var activeDropBox = null;
  
      $(&quot;select.drop-box&quot;).change(function () {
          var questionId = $(this).attr(&quot;questionId&quot;);
          var selectedAnswer = $(this).val();
          activeDropBox = this;
  
          alert(this.questionId);
  
          $.ajax(
          {
              type: &quot;POST&quot;,
              url: answerChangedActionUrl,
              data: { questionId: questionId, selectedValue: selectedAnswer },
              success: function (data) {
                  SetElementVisibility(data.ShowElement, questionId);
              }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                  alert('XMLHttpRequest:' + XMLHttpRequest.responseText);
                  alert('textStatus:' + textStatus);
                  alert('errorThrown:' + errorThrown);
              }
          });
      });
  
      function SetElementVisibility(visible, questionId) {
          // I would like each child to then trigger the change event...
          $(&quot;.childOf&quot; + questionId)[visible ? 'show' : 'hide']('slow');
          
          // Suggested code
          //$(&quot;.childOf&quot; + questionId + &quot; select&quot;).trigger(&quot;change&quot;);
  
          if (!visible) {
              $(&quot;.childOf&quot; + questionId + &quot; select&quot;).attr('selectedIndex', 0);
          }
      }
  }
  </code></pre>
  <p>The suggestions so far seem to work, but as the change event triggers an ajax post it now seems to fail here. I'm going to play around with it but that is something for another question I feel.</p>