Would appreciate any pointers regarding which function to use for this:
Say I have something like this:
<div class="myTweet">Check out this awesome link <a href="http://bit.ly/uglylookinglink>http://bit.ly/uglylookinglink</a></div>
Which reads:
Check out my awesome link http://bit.ly/uglylookinglink
All I want to do is move the tag to the front of the containing div so that the whole sentence becomes the link, and remove the horrible http://bitl.y link that comes with it.
So it would look like this afterwards:
<div class="myTweet"><a href="http://bit.ly/uglylookinglink>Check out this awesome link </a></div>
Which will then read:
Check out my awesome link
It’s probably really easy but i cant find the right way to go.
Thanks,
Marc
You can use
.wrapInner()and the<a>itself to do so, like this:You can give it a try here, this takes the link, removes it original contents via
.empty(), then wraps the<div>‘s text using the anchor element itself.