Making all links inside of a div call the same function?
<p>I'm trying to make a notification area that will show alerts.</p>

<pre><code>return this.each(function() {
  jQuery('&lt;div class="' + o['className'] + '"&gt;' + o.msg + ' +
         '&lt;a href="#" onclick="$(this).parent().remove(); dismiss(' + o["id"] + ');"&gt;X&lt;/a&gt;' + '&lt;/div&gt;')
    .appendTo(this);
});
</code></pre>

<p>This just takes a message pulled from the database, and shows it to the user. If the user clicks the X then it will call dismiss() which will mark it as being read in the database.</p>

<p>The thing is, if the message itself contains a link to another page or external site, I also want to call dismiss() before the user leaves the page. Is there anyway to alter this javascript to take all <code>a</code> elements (the X and any links that would appear in the message) and change the onclick to call the function?</p>
