 <p>As you requested, to automate this for all items with the class <code>moveID</code>, you could use this:</p> <pre><code>$('.moveID').each(function() { var id = this.id; $(this).removeAttr('id').children().first().attr('id', id); }); </code></pre>