Question

How do i remove the underline and hyperlink from a web part title? Specifically i still want the title to appear on this web part, i just don't want it to be a clickable link and i want to remove the underline that appears on hover/click. CSS solution preferred if possible.

I've tried a few searches for similar requests and the solutions don't seem to be working.

any ideas?

Was it helpful?

Solution

Try 1

The first idea is Modify Web Part Properties and clear the Title URL field value in the Appearance section. Click OK and first it works ok. But after reloading the page SharePoint automatically fills the Title URL property with the URL of the default view of the list and the link comes back. 😦

Try 2

A workaround can be replacing the Title URL value with a “#”. In this case the link will not disappear but it will point to the actual page. Better, but still far from good. :S

Try 3

The second workaround can be setting the Title URL value with “http://about:blank”. This will still render the title as link but nothing will happen when the user clicks on it. Unfortunately it can be quite misleading for users especially if you have different styles for link than labels (color, underline, hover, etc) :l

Solution

The best solution I can think of is setting Title URL value with some special string such as “###” and using a simple JavaScript or jQuery to remove all the links which point to this string:

The following jQuery will do it. Don’t forget to include a reference to the jQuery library if you haven’t done so.

jQuery(document).ready(function () {

       $('a').filter("[href='###']").each(function () {
        $(this).replaceWith($(this).html());
       });

 });

Source

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top