Created
November 12, 2013 17:49
-
-
Save mikedugan/7435411 to your computer and use it in GitHub Desktop.
wraps an img in anchor from sibling, and removes the anchor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //where containerDiv is the parent of the img and a | |
| //where imgwrap is the anchor the img will be wrapped in | |
| $('.containerDiv').each(function() { | |
| $('img',$(this)).wrap('<a href="' + $('.imgwrap',$(this)).attr('href') + '"></a>'); | |
| }); | |
| $('.imgwrap').remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment