Why is my attribute value not changing using jQuery's .attr(x,y)
<p>I am trying to change the value of the<code>onclick</code>attribute:</p>

<pre><code>&lt;span onclick="addPropertyToQuery(this)" tagId="${property.id}" class="half-padding half-margin tag"&gt;
</code></pre>

<p>The addPropertyToQuery() method looks something like this</p>

<pre><code>function addPropertyToQuery(clicked){ 
     //
     // Other stuff
     //
    $(clicked).attr('onclick','removePropertyFromQuery(this)');
    alert($(clicked).attr('onclick'));
}
</code></pre>

<p>I can't see what I am doing wrong, what is most confusing is that the alert gives the correct value.</p>
