601 posts
  • 6 Years of Membership
  • Affiliate Level 1
  • Author Level 3
  • Collector Level 2
+2 more
SparkyFlash
says

Thanks for pointing this out. Here’s a quick fix for the problem:

Use data-rel in HTML and then use jQuery to change the data-rel to rel attribute:

$('selector goes here a').each(function() {
        $(this).removeAttr('data-rel').attr('rel', 'prettyPhoto');
});

Validates perfectly :) Hope this will help someone.

15 posts
  • 4 Years of Membership
  • Author Level 4
  • Exclusive Author
dbooom
says

This one is more flexible in my opinion:

$('a[data-rel]').each(function() {
    $(this).attr('rel', $(this).attr('data-rel')).removeAttr('data-rel');
});
2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+15 more
revaxarts
says

Hey Guys!

Since jQuery 1.4.4 this is working:
<a data-rel="somedata"></a>

$('a').data('rel') == "somedata";

So no need for removeAttr()

253 posts
  • Author Level 4
  • Affiliate Level 2
  • Sweden
  • Exclusive Author
+2 more
graphic_dev
says
dbooom said
This one is more flexible in my opinion:
$('a[data-rel]').each(function() {
    $(this).attr('rel', $(this).attr('data-rel')).removeAttr('data-rel');
});
Thanks guys, this worked for me (using prettyPhoto).
by
by
by
by
by
by