Changing an element's ID with jQuery
<p>I need to change an element's ID using jQuery.  </p>

<p>Apparently these don't work:</p>

<pre><code>jQuery(this).prev("li").attr("id")="newid"
jQuery(this).prev("li")="newid"
</code></pre>

<p>I found out that I can make it happen with the following code:</p>

<pre><code>jQuery(this).prev("li")show(function() {
    this.id="newid";
});
</code></pre>

<p>But that doesn't seem right to me. There must be a better way, no? Also, in case there isn't, what other method can I use instead of show/hide or other effects? Obviously I don't want to show/hide or affect the element every time, just to change its ID.</p>

<p>(Yep, I'm a jQuery newbie.)</p>

<p><strong>Edit</strong><br>
I can't use classes in this case, I must use IDs.</p>
