How to hide a ribbon in SharePoint 2010/2013/Online using Jquery
This post explains how to hide a SharePoint Ribbon in SP 2010/2013/ SP Online using jquery.
It is very simple jquery code to hide the ribbon.
For example say suppose you want to hide Add New Item Ribbon in a List called Contacts.
Here is how efficiently we can achieve this.
Happy coding :)
It is very simple jquery code to hide the ribbon.
For example say suppose you want to hide Add New Item Ribbon in a List called Contacts.
Here is how efficiently we can achieve this.
$(document).ready(function () {Above simple jquery code does the trick. As you can see, if the url is lists/contacts, we are calling the method hideRibbon with a delay. And in the hideRibbon method we are calling the same method again with a delay. which will keep hiding the ribbon.
var currentPage = decodeURIComponent(window.location.href.replace(/\+/g, " "));
if (currentPage.contains("Lists/Contacts")) {
window.setTimeout(hideRibbon, 500);
}
});
function hideRibbon() {
$('span[id^="Ribbon.ListItem.New.NewListItem"]').hide()
window.setTimeout(hideRibbon, 200);
}
Happy coding :)
Comments
Post a Comment