title: Trigger events defined after DOM load - JIRA open new issue modal
body: <p>I am building a third party plugin to the popular platform Atlassian JIRA and where I have implemented a calendar. However when I click on a day outside any event, it triggers a function which will trigger the <code>#create_link event</code>.</p>
  
  <p>When that event gets fired a new modal window opens and the user may fill out a new issue. The thing is that I want to change the issuetype field and then fill in one field automatically. However, I have no idea how to generate a new window with these result (I don't think it's possible) and therefore my only option was Javascript events.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>jQuery.when(AJS.$('#create_link').trigger('click')).done(function() {
      jQuery.when(jQuery('#issuetype-field').trigger('click')).done(function() {
          jQuery('.aui-list-item-li-event').find('a').trigger('click');
      });
  });
  
  //I have also tried to use `.then`
  </code></pre>
  
  <p>The thing is, the triggers work when run separately in console but it seems like the <code>jQuery.when</code> doesn't. Because the next event triggers long before the window has been loaded.</p>
  
  <p><strong>What I need is a way to wait to trigger the last 2 events by using callbacks on the triggers or what not</strong>. How can I solve this problem? Also, if anyone know how to create a new issue window with js in Jira that is also a very acceptable answer.</p>