title: jQuery's event.stopPropagation() causing problems with Rails :remote => true
body: <p>I've created some custom "popups" (initially styled with "display:none;") that are toggled via an adjacent ".popup_trigger" link with the following summarized functionality:</p>
  
  <pre><code># /public/javascripts/application.js
  jQuery(document).ready(function(){
  
    // Trigger a popup
    jQuery('.popup_trigger').live('click', function(event) {
      jQuery(this).next('.popup').toggle(0, function() {
        // Prevent the jQuery('body').click() below if the click occurs inside the popup
        jQuery(this).click(function(event){
          event.stopPropagation();
        });
      });
      return false;
    });
  
    // "Outside" click hides popup
    jQuery('body').click(function() {
      jQuery('.popup:visible').toggle();
    });
  });
  </code></pre>
  
  <p>This works fine for displaying the popups and then hiding them when an "outside" click occurs. However, inside one such popup I have the following:</p>
  
  <pre><code>&lt;%= link_to 'Delete medical record', medical_record, :confirm =&gt; 'Permanently delete this medical record?', :method =&gt; :delete, :remote =&gt; true %&gt;
  </code></pre>
  
  <p>Which renders the following:</p>
  
  <pre><code>&lt;a href="/medical_records/1" data-confirm="Permanently delete this medical record?" data-method="delete" data-remote="true" rel="nofollow"&gt;Delete medical record&lt;/a&gt;
  </code></pre>
  
  <p>My problem is that when I trigger the popup to display, the <code>event.stopPropagation();</code> call appears to disable the remote functionality of this link. That is, when I click the link, it sends a plain old (not remote) GET request of '/medical_records/1' which looks for the show action instead of destroy.</p>
  
  <p>If I comment out the <code>event.stopPropagation();</code> in my JS above, the remote link works fine, but then the popup hides when I click inside.</p>
  
  <p>What can I do to have it so an active popup hides only when clicked outside of itself, and also allow the remote links to work?</p>
  
  <p>Thanks.</p>