I'm trying to hide or show fields in a form based on the values selected in another. I cam across this blog: https://spgeeks.devoworx.com/show-hide-fields-based-on-choice-field-selection-using-jquery-in-sharepoint/ which seemed to fit the bill but I don't get the option to add a script editor webpart when I click on Form Web Parts/Default New Form. Is this not an option in SharePoint Online?

2 Answers 2


By Default client side scripting is disabled in SharePoint Online, you need to enable it to make script editor in you classic pages. You can do this at Tenant level or at site collection level.. Below is what you can do at site collectoin level.

To enable custom scripts on modern sites, you will need to use SharePoint Online Cmdlets. If you don’t have it installed download it from here.

Once installed:

Open the PowerShell console Execute the command Connect-SPOService -Url https://tenant-admin.sharepoint.com Execute the command bellow with the url for the modern site collection Set-SPOSite -Identity https://tenant.sharepoint.com/sites/contoso -DenyAddAndCustomizePages 0

Ref link- https://sharepoint.handsontek.net/2018/10/28/enable-custom-script-on-modern-sharepoint-sites-using-powershell/#step2

I hope this helps..!!!


there is actually existing script editor for modern sharepoint, Modern Script Editor, though its not really advisable to use this since there could be a performance issues, on the other hand you can peek on SPFX

Just a suggestion if you would consider having a modern page, embed the form in the modern page with Embed webpart (its already part of modern sharepoint) then you can add the modern script editor to manipulate DOM elements with the OOTB form. You can embed jQuery or any libray you want, styles, js, scripts, etc. to satisfy what you want to do.

Hope the concept helps, happy learning!

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.