How to hide a master page div when displayed in a SharePoint dialog box?
Check out Best Alternative to InfoPath -> Try Now
In this SharePoint customization tutorial, we will discuss how to hide master page elements in the dialog box in SharePoint 2013.
Recently we were working in a migration web site from MOSS 2007 to SharePoint 2010 and then to SharePoint 2013 by using the database upgrade approach. There we were using a master page and on that master page, there was a navigation menu presented there. That navigation menu was coming in our Add item in list dialog boxes.
When I search I found a very good post from Eric and followed that and it works like a champ. Thanks, Eric for sharing this.
In SharePoint 2013 there is a class known as “ms-dialogHidden”. If you will add this class to the HTML block, that Html block will not appear in the dialog boxes.
<div id="global-menu" class="ms-dialogHidden"> Here was our global menu. </div>
After this, the above section will not appear in the dialog boxes in SharePoint 2013. We can check this in Master pages, Page layouts or any other pages referenced from the master pages.
The same thing works in SharePoint 2010, but with a different class name. The class name is: “s4-notdlg”
<div id="global-menu" class="s4-notdlg"> Here was our global menu. </div>
Here is an example wherein Add new item dialog box one of our global navigation is coming like below:
And after using the ms-dialogHidden class, the global navigation did not appear like below:
You may like following SharePoint master page tutorials:
- Create a custom master page using Design Manager in SharePoint Online/2013/2016
- Set master page for a particular page in SharePoint 2016 or SharePoint Online
- SharePoint Online Step by Step Tutorial on how to create a new custom master page by using the existing master page
- Creating a fixed width master page in SharePoint 2013
- Steps to create a master page using design manager in SharePoint 2013/2016/Online
- Reference jQuery in SharePoint 2013/2010 master page or in Application Page
- Customize access denied page in SharePoint 2013
- Create and Deploy SharePoint 2013 site pages or content pages using Visual Studio 2013
- Sorry you don’t have access to this page while editing page in SharePoint 2013
Hope, this SharePoint tutorial helps to hide a master page div when displayed in a SharePoint dialog window.
SharePoint Online FREE Training
JOIN a FREE SharePoint Video Course (3 Part Video Series)