579 posts
  • Bought between 10 and 49 items
  • Europe
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 5 000 and 10 000 dollars
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');
});
2001 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
+3 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()

252 posts
  • Sweden
  • Sold between 1 000 and 5 000 dollars
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
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