How do I control the modification trigger with Jquery
<p>A section of a page is clickable when I move mouse over it. I want it to be grey and un-clickable if the class of this section is "completed". How do I do that?</p>

<p>I have some code as follows:</p>

<pre><code>$(document).ready(function() {
    $session_rows = $(".coaching_page .user_session_info .session_info tr[session_id]");

    $session_rows.bind("mouseenter mouseleave", function() {
        $(this).toggleClass("highlighted");
    });

    $(".created_column", $session_rows).add(".session_info_column", $session_rows).click(function() {
        $(window).attr("location", "&lt;?php echo $progress_url ?&gt;/session/" + $(this).parent().attr("session_id"));
    });

    $session_rows.find(".trash_column span.ui-icon-trash").bind("mouseenter mouseleave", function() {
        $(this).toggleClass("highlighted");
    }).click(function() {
        if (confirm("Are you sure you want to delete this Case?")) {
            $(window).attr("location", "&lt;?php echo $remove_url ?&gt;/session/" + $(this).parent().parent().attr("session_id"));
        }
    });
});
</code></pre>

<p>This is HTML part:</p>

<pre><code>&lt;table class="session_info"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;td class="created_column"&gt;Created Date&lt;/td&gt;
            &lt;td class="session_info_column" colspan="2"&gt;Case Info&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;?php foreach($sessions as $session) : ?&gt;
        &lt;tr session_id="&lt;?php echo $session-&gt;getId() ?&gt;" class="completed"&gt;
            &lt;td class="created_column"&gt;&lt;?php echo $session-&gt;getDateTimeObject('created_at')-&gt;format('m/d/Y') ?&gt;&lt;/td&gt;
            &lt;td class="session_info_column"&gt;
                &lt;table&gt;
                    &lt;tr&gt;
                        &lt;td class="info_label"&gt;Coach:&lt;/td&gt;
                        &lt;td&gt;&lt;?php echo $session-&gt;getCoachUser()-&gt;getFullName() ?&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td class="info_label"&gt;# Contacts:&lt;/td&gt;
                        &lt;td&gt;&lt;?php echo $session-&gt;getCoachingReports()-&gt;count() ?&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td class="info_label"&gt;Last Updated:&lt;/td&gt;
                        &lt;?php $edit = $session-&gt;getMostRecentReportEdit() ?&gt;
                        &lt;td&gt;&lt;?php echo $edit ? $edit-&gt;getDateTimeObject('created_at')-&gt;format('m/d/Y') : '[No Edits Yet]' ?&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td class="info_label"&gt;Total Minutes:&lt;/td&gt;
                        &lt;td&gt;&lt;?php echo $session-&gt;calculateTotalMinutes() ?&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/td&gt;
            &lt;?php if($sf_user-&gt;hasCredential(Attribute::COACHING_EDIT_ACCESS)) : ?&gt;
            &lt;td class="trash_column"&gt;&lt;span class="ui-icon ui-icon-trash"&gt;Remove&lt;/span&gt;&lt;/td&gt;
            &lt;?php endif ?&gt;
        &lt;/tr&gt;
        &lt;?php endforeach ?&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>
