Verify is page is in edit Mode using JQuery SharePoint

Below is the sample JavaScript code to detect whether the page is in edit mode or not. This call will return true if page is in edit mode, or false if in view mode.

var InEditMode =(document.getElementById(‘MSOLayout_InDesignMode’).value == 1) ? true : false;

This will work in All SharePoint versions!

Next Steps

Before your UI calls or UI functions – perform a quick logic test. If the value of InEditMode is false, proceed with the rest of the script:

if(!InEditMode){

}

You could even use this technique to add a class name to the or tag to circumvent issues from CSS.

Feel free to drop me email on bipinparshottam@gmail.com, skype:bipin.pankhania incase of queries.

Leave a comment