How can I add text link in a div using jquery?

Total Post:24

Points:168
JQuery 
 1608  View(s)
Ratings:
Rate this:

I want to place text 'Mindstick' with hyperlink <a href="http://www.mindstick.com" inside a div having class-id as "my-link".

How can this be done using jquery or javascript?

  1. Post:24

    Points:168
    Re: How can I add text link in a div using jquery?

    You can do this :

    $('.my-link').html('<a href="http://www.mindstick.com">Mindstick</a>');

    But it would add the hyperlink to all .my-link divs, so it's better to add an ID to div and use the ID on jquery code.

     

      Modified On Mar-31-2018 06:21:26 AM

Answer