Subscribe: SharePoint SharePoint SharePoint
Showing posts with label what is a script error. Show all posts
Showing posts with label what is a script error. Show all posts

Friday, July 5, 2013

Content Editor Web Part script error

Many a times when we add a ECMA script to a CEWP, it does not work as expected. This mainly happens because CEWP does not start a server thread. ECMA script can only be executed when a server thread or worker process is associated to it. So in order to make it work, we need to add a function i.e. "ExecuteOrDelayUntilScriptLoaded". It first loads the "SP.js" file so that it can start a server thread.

SharePoint 2010


After loading the "SP.js" file , the ECMA script in the CEWP is executed without any error.

Following is the code depicting the same :