jquery change attribute
Posted
by junray
on Stack Overflow
See other posts from Stack Overflow
or by junray
Published on 2010-04-16T15:47:53Z
Indexed on
2010/04/16
15:53 UTC
Read the original article
Hit count: 397
hi, i have 4 links and i need to change the href attribute in a rel attribute. i know i cannot do it so i'm trying to get the data from the href attribute, setting a new attribute (rel), inserting the data inside it and then removing the href attibute.
basically i'm doing this:
$('div#menu ul li a').each(function(){
var lin = $(this).attr('href');
$('div#menu ul li a').attr('rel',lin);
$(this).removeAttr('href');
})
})
it works but it sets the same rel data in every link i have.
any help?
thnx
© Stack Overflow or respective owner