Is there a way in JQuery to select text from the html document and add a link around it?
Many Thanks, Nav
You can use jQuery's wrap
function:
$(someSelector).wrap(function() {
var link = $('<a/>');
link.attr('href', 'somewhere_far_far_away');
link.text($(this).text());
return link;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With