Convert Text to Links using jQuery

Yesterday for one of my requirement, I needed to convert bold text of the a div element to hyperlink using jQuery. To do this, jQuery provides wrap() method which is used to wrap HTML element around each of the matched elements.

Below jQuery code, uses jQuery wrap() method to wrap the bold text to hyperlink.

$(document).ready(function() {
  $("#btnConvert").click(function() {
    $('div b').wrap('<a href="http://jquerybyexample.blogspot.com/"/>');
  });
});?

See result below

See Complete Code

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...