I am facing issue while calling the function using ExecuteOrDelayUntilScriptLoaded() I am writing like:

<script language="javascript" type="text/javascript">
 ExecuteOrDelayUntilScriptLoaded(PopulateDropDown, "sp.js");

Now my function PopulateDropDown() doesn't get executed.

3 Answers 3


There is a slight difference on how ExecuteOrDelayUntilScriptLoaded works depending on what page it is being executed on.

Sometimes SP.js is available and other times it is not. When it's not availble, the call to ExecuteOrDelayUntilScriptLoaded will fail as SP.js is not loaded.

View my answer to a similar question here for more on this.


ExecuteOrDelayUntilScriptLoaded Method

You can try this:

jQuery(document).ready(function() {
 ExecuteOrDelayUntilScriptLoaded(myfunction, "sp.js");

myfunction = function(){
 /*Do something here.*/

Or try following the answer found here:

ExecuteOrDelayUntilScriptLoaded(function () { alertThis("Hello World") }, "core.js");

function alertThis(value)

In SharePoint 2013 prefer SP.SOD.executeFunc(key, functionName, fn) Method instead of SP.SOD.executeOrDelayUntilScriptLoaded(func, depScriptFileName) Method to ensure that sp.js library is loaded before the specified callback function runs.



ExecuteOrDelayUntilScriptLoaded(PopulateDropDown, "sp.js");


SP.SOD.executeFunc('sp.js', 'SP.ClientContext', PopulateDropDown);

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.