I have a page with Script Editor. now I need to add another one to try something without running the code at the first Script Editor.

Is there a method to disable the first Script Editor on my page without delete it or comment the code within it ?

  • 2
    The answer is No. It is like asking: I have two lines in my code, how can I run line 2 and not run line 1. Now SP does make it possible to exclude a line with Target Audience setting in the webpart properties.. but that requires different logins. Alternative you could change line 1 (script 1) to not run when there is a QueryParameter Commented Sep 8, 2016 at 22:52

1 Answer 1


Have you tried to add a document "script" Element after some logic?

var myscript = document.createElement('script');    
  • Thanks for your reply , but Should you tell me what this will do ? Commented Sep 6, 2016 at 20:14
  • That code creates a DOM script element in runtime. I've used it in some script editor (and content editor) to select which code to add programmatically. check more at: w3schools.com/jsref/dom_obj_script.asp Commented Sep 6, 2016 at 20:25
  • I really appreciated your answer , but what I need is to disable script at first script editor web part to run a second script at another script editor at the same page that is not related to the first one , so please tell me how I can use the above code to achieve this scenario , thanks in advance Commented Sep 6, 2016 at 20:56
  • ok, I'll take the time later to try to give you an example. Commented Sep 6, 2016 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.