simple question, I am editing a masterpage and have inserted a js file that has a function that needs to be invoked with body onload. How would I be able to do this in the masterpage?


SharePoint specific

SharePoint provides the _spBodyOnLoadFunctionNames array. When the body is loaded, the onload event handler executes each function whose name is contained in this array, for example:

 function funcName()   


Specify a function to execute when the DOM is fully loaded

$(function() {

Use _spBodyOnLoadFunctionNames.push("FunctionName");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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