Insert href link on existing text: abc, part of a DIV ID: wpfunc01 on a SPS2013 List page. I guess this can be achieved via Jquery.

Please assist with the complete code to insert href on existing text: abc


I got the solution, here is it that may help others in the community -

In the below code, I have modified the TEXT Value: ALL with the same value and added Hyperlink.

<script type="text/javascript">

// Check the main container is ready
    // Get each div
        // Get the content
        var str = $(this).html();
        // Set the regex string
        var regex = /All/ig
        // Replace plain text links by hyperlinks
        var replaced_text = str.replace(regex, "<a href='http://www.example.com' target='_blank'>All</a>");
        // Echo link

  • doesnt allows to mark answer for 2 days. – Jason Jun 7 '16 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.