tl;dr – In SharePoint, use _spBodyOnLoadFunctionNames instead of $(document).ready
When using JavaScript
How you do it in jQuery
$(document).ready(function() {
// put your code here...
});
How you do it in SharePoint
function loadMyPage() {
// put your code here...
}
_spBodyOnLoadFunctionNames.push("loadMyPage");