Skip to content

Instantly share code, notes, and snippets.

@jester1979
Last active October 9, 2015 09:28
Show Gist options
  • Save jester1979/3478797 to your computer and use it in GitHub Desktop.
Save jester1979/3478797 to your computer and use it in GitHub Desktop.
Activate html tags with a filled data-src-attr and an empty src-attr
$( 'iframe[data-src], script[data-src]' ).each( function() {
$this = $( this );
$this.attr( 'src', $this.attr( 'data-src' ) );
) ); //you should do this after a visitors approval
/* Note: the jQuery-selector above is not the best selector for performance, to use a class instead would be better */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment