Wednesday, April 4, 2012

Edit Sharepoint Breadcrumb by JQuery/Javascript



Folks,

You can follow the below mention steps to edit the Sharepoint Breadcrumb.
  • Create a new master page ("defaultNew.master").
  • Insert the jquery code: 
  • <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      // Load jQuery
      google.load("jquery", "1.2.6");
    </script>
    <script type="text/javascript">
    $(document).ready(function(){ 
                    $('a[class="ms-sitemapdirectional"]').each(function(i)
                                    {
              $(this).attr('href', $(this).attr('href').replace('Wiki%20Pages/Forms/AllPages.aspx', 'Wiki%20Pages/Home.aspx'));
                                          $(this).attr('href', $(this).attr('href').replace('/Forms/AllPages.aspx', ''));
                                    });
    });
    </script>
  • Upload the "defaultNew.master" to the masterpage gallery of root site.
  • Set the "defaultNew.master"  as the System Master Page of site.
Note: I am replacing the URL in the breadcrumb list, you can modify in other ways as well.


Feel free to let me know if you face any issue.

No comments:

Post a Comment