584 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 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
  • Has been part of the Envato Community for over 3 years
  • Has sold $5,000+ on Envato Market
  • Located in Europe
  • Sells items exclusively on Envato Market
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');
});
2028 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Provided great feedback to improve the user experience on Envato Market
  • Interviewed on an Envato blog
+9 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
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Sweden
+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