I want the following code snippet in master page to run if the current loaded page is in edit mode as follows:
<!-- If edit mode, then add the following script -->
<script type="text/javascript">
document.documentElement.className += ' edit-mode';
</script>
<!-- End if -->
simply, my script will add an edit-mode
class to the html
tag, that's it.
how can I do that ?
Thanks
You can use the PublishingWebControls:EditModePanel control. This control will process the information included in this tag when the page is in the Edit mode.
<PublishingWebControls:EditModePanel runat="server" id="IncludeEditModeClass" >
<asp:Content>
<script type="text/javascript">
document.documentElement.className += ' edit-mode';
</script>
</asp:Content>
</PublishingWebControls:EditModePanel>