title: Trigger a jQuery Event Handler Assigned in a Different Code Block
body: <p>I have a case where a click handler is defined/assigned in one jQuery code block (file) and I want to trigger it from another click event defined/assigned in a different jQuery code block.  How can I accomplish this?</p>
  <p>The following code is a greatly simplified version of what I am trying to accomplish. The behavior I want to see is a JavaScript alert &quot;Element One&quot; when I click <code>#Element2</code>.</p>
  <p>Example HTML:</p>
  <pre><code>&lt;p id=&quot;Element1&quot;&gt;Element One&lt;/p&gt;
  &lt;p id=&quot;Element2&quot;&gt;Element Two&lt;/p&gt;
  </code></pre>
  <p>First jQuery code block:</p>
  <pre><code>$(document).ready(function() {
      $('#Element1').click(function() {
          alert('Element One');
      });
  });
  </code></pre>
  <p>Second jQuery code block:</p>
  <pre><code>$(document).ready(function() {
      $('#Element2').click(function() {
          $('#Element1').click();
      });
  });
  </code></pre>
  <hr />
  <p><strong>UPDATE:</strong> My original example actually works. I was building upon my field hint <a href="https://stackoverflow.com/questions/2554779/jquery-ui-close-dialog-when-clicked-outside">jQuery UI Dialog solution</a>, and didn't account for about the <a href="https://stackoverflow.com/questions/2554779/jquery-ui-close-dialog-when-clicked-outside">'clickoutside' handler</a> that I was using.  Adding a check to for the second element in my 'clickoutside' handler allows the dialog to display.</p>