How to toggle class of clickable image
<p>Our users have a table showing their titles. (They're contained in a datatable, if that matters).  The idea is to simply have an image that they can click to toggle published or not.  The below code <em>does change the image</em> as expected, but does <em>not change the class</em>.</p>

<p>I've also tried addclass/removeclass, but with the same results.  Am I missing something obvious, or am I doing something completely wrong?</p>

<pre><code>&lt;img class="title_publish" src="IsNotPublished.png"&gt;'
&lt;img class="title_unpublish" src="IsPublished.png"&gt;


$('.title_publish').live('click', function () {
    this.src="IsPublished.png";
    this.toggleClass("title_publish");
    this.toggleClass("title_unpublish");
} );

$('.title_unpublish').live('click', function () {
    this.src="IsNotPublished.png";
    this.toggleClass="title_publish";
    this.toggleClass="title_unpublish";
} );
</code></pre>
