Skip to main content
1 of 2
Michael Colbs
  • 3.9k
  • 3
  • 49
  • 98

How about wrapping your script in an Edit Mode check? Then the lists will be expanded while editing.

var editMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

if (editMode != '1')
{
   $(document).ready(function(){
      $(".category-qms-expand").click(function(){
       var id = $(this).attr("id");
       var name = id.split("-")[1];
       $("#category-qms-" + name).toggle(400);
       if($(this).html() == "CLOSE"){
         $(this).html("EXPAND");
       }
       else{
         $(this).html("CLOSE");
       }
       return false;
     });
  });
}

More info from this post:

How do I know if the page is in Edit Mode from JavaScript?

Michael Colbs
  • 3.9k
  • 3
  • 49
  • 98