601 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+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
  • Has been part of the Envato Community for over 4 years
  • Has sold $5,000+ on Envato Market
  • 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');
});
2227 posts
  • Located in Europe
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Participated in a focus group or interview to improve the user experience on Envato Market
+10 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 sold $5,000+ on Envato Market
  • Has referred 10+ members
  • Located in Sweden
  • Sells items exclusively on Envato Market
+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).

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by