Just little about C#, .NET, SQL Server, SharePoint and SAP

Hiding links using jQuery in SharePoint

Posted by zieglers on October 22, 2010

If you want to hide links, tables, and elements on a SharePoint site without touching its functionality, there is a clean way doing so using jQuery.

Let’s say you want to remove some links on create.aspx page or on your home page of your SharePoint site. You can do this as follows: (assuming that you already host your jquery-1.*.*.min.js file somewhere in your site or in layouts folder)

1. Create a feature, which adds a control to a page.

2. Render this control on every page

3. Use jQuery to find and remove links you want.

For example, below code will remove Recycle Bin from quick launch menu only on home page.

<script language=”javascript” type=”text/javascript”>

    if (location.href.indexOf(‘default.aspx’) >= 0) {

        $(document).ready(function() {





Now, once you activate your feature, it’ll render above control on everypage and based on your if clause in the script, you can hide any link, table, element you want on any page.

P.S. try this with table.ms-main and see what happens!!!


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: