title: Creating a DIV with jQuery and have its parts be linked to other Jquery functions
body: <p>Okay so I'm building a custom Wordpress theme and I need a custom modal window (div) to appear when a user clicks a certain link on my page. I designed the modal window, and linked certain parts of it (such as 'X' button to close) with jQuery functions. </p>
  
  <p><strong>Works fine when I put the div onto the page itself,</strong> but when I try to create that same DIV with a separate jQuery function which gets called when a user clicks the link, it creates and displays that div, but the function for the 'login-close' class link does absolutely nothing this time.</p>
  
  <p>Here's how I create the DIV with jQuery:</p>
  
  <pre><code>var passion = jQuery(this).attr('data-passion');
  
  var div = $('&lt;div id="itinerary-modal"&gt; &lt;a class="login-close" href="#"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&lt;/a&gt; &lt;p&gt;You have successfully added&lt;br&gt; &lt;span&gt;'+passion+'&lt;/span&gt;&lt;br&gt; to your wishlist. &lt;/p&gt; &lt;a href="" class="btn"&gt;See my wishlist&lt;/a&gt; &lt;a href="#" class="btn"&gt;OK&lt;/a&gt; &lt;/div&gt;');
  
  $("#content").append(div);
  
  div.show(); /* "itinerary-modal" is display:hidden in CSS */
  </code></pre>
  
  <p>This is of course all embedded in a link.click jQuery function. As I said, displays the div just fine but I want it to function (close on 'login-close' class link) as it did when it was placed on the page as pure HTML.</p>