Changing element Id using jquery
<p>I have this code on JsFidlle</p>

<p><a href="http://jsfiddle.net/MzJaH/14/" rel="nofollow">http://jsfiddle.net/MzJaH/14/</a></p>

<p>I want to change the Id of the a elements with this code:</p>

<pre><code>$(document).ready(function () {
    $('div.chapter a[href*="wikipedia"]').attr({
        rel: 'external',
        title: function () {
            return 'Learn more about ' + $(this).text() + ' at Wikipedia.';
        },
        id: function (index, oldValue) {
            return 'wikilink-' + index;
        }
    });
});
</code></pre>

<p>I wanted the anchor tags to be id='wikilink-0' but it doesnt happen....</p>

<p>And I dont know why I need this var oldValud there in function(index, oldValue) ...</p>
