Your syntax is incorrect. What you want, I think, is: $(this).attr({ 'rel','external', 'id',index });
(commas in place of the colons) -Adam On Sep 19, 8:20 am, "Lord Gustavo Miguel Angel" <goosfanc...@gmail.com> wrote: > Hi, > > I have this code jQuery: > > $('div.contenedor a').each(function(index){ > $(this).attr({ > 'rel': 'external', > 'id': index > }); > }); > > -------------------------- > This´s my html > -------------------------- > > <div id="contenedor"> > > <h1>UNA TERTULIA INESPERADA</h1> > > <p>0) En un agujero en el suelo, vivía un hobbit. No un agujero > húmedo, sucio, repugnante, con restos de gusanos y olor a fango, ni tampoco > un agujero seco, se <a href="http://www.google.com.ar" >abrían </a> > > --------------------------------------- > > Where is error? > i need show in source <a rel="external" id=X href="http://www.google.com.ar" > >abrían </a> > where x is "index" > > thank´s