Add a Link to web part title in SharePoint Online/2013/2016

This SharePoint Online tutorial we will discuss how we can add a link into a web part title in SharePoint Online or SharePoint 2013/2016. Also, I will show how user can go to a particular section on click on that link in SharePoint 2013/2016 or SharePoint Online.

In this particular scenario, I have few web parts in a SharePoint Online web part page. Since there are many web parts in this page, users wanted to have a “Go to Top” link in each web part title section. When user clicks on the Go to Top link, user should navigate to the Top section of the page.

Here I have a top section like this and I have few web parts added into the page.

Below is the code which wyou can use inside a script editor web part or inside a content editor web part in your SharePoint Online site.

<span id="topsection">Top Section</span>
This is the top section, when user clicks on Go to Top button in the web part title link, then user will be navigate to this top section in SharePoint Online.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () { 

    var className='.ms-webpart-titleText';
    $(".ms-webpart-chrome-title span h2").each(function(inx){        
        var webPartTitle = $(this).text();
                
        //Check web part title
        if(webPartTitle.indexOf("Address")>=0)
        {    
$(this).prepend("<div class='small' style='cursor: pointer; display: inline-block;  float:right; text-align:center'><a href='#topsection'>Go to Top</a>  </div>") ;        
                       
        }
    });
});
</script>

Once you save the code and click on the Go to Top button in the Address web part, then it will navigate to the top section of the page like below:

Add a Link to web part title in SharePoint Online/2013/2016
Add a Link to web part title in SharePoint Online/2013/2016

You may also like following SharePoint Online tutorials:

Hope this SharePoint tutorial helps you to add a Link to web part title in SharePoint Online/2013/2016. And also you can navigate to another section by clicking on the link.

>