Every line of 'jquery document ready shorthand' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
44 function domReady(callback){ 45 // TODO: support IE7-8 46 if(/e/.test(doc.readyState||'')){ 47 // TODO: fix the issues with sync so this can be run immediately 48 setTimeout(callback, 200); 49 }else{ 50 doc.addEventListener("DOMContentLoaded", callback); 51 } 52 }
42 function domReady(callback) { 43 const doc = document; 44 const attach = 'addEventListener'; 45 46 if (doc[attach]) { 47 doc[attach]('DOMContentLoaded', callback); 48 } else { 49 window.attachEvent('onload', callback); 50 } 51 }
9 export function domReady(callback) { 10 readyCallbacks.push(callback) 11 }
7 function domReady(callback) { 8 if (doc.readyState === "complete" || (doc.readyState !== "loading" && !doc.documentElement.doScroll)) 9 setTimeout(() => callback && callback(), 0) 10 else { 11 let handler = () => { 12 doc.removeEventListener("DOMContentLoaded", handler, false) 13 win.removeEventListener("load", handler, false) 14 callback && callback() 15 } 16 doc.addEventListener("DOMContentLoaded", handler, false) 17 win.addEventListener("load", handler, false) 18 } 19 }
1 function jqueryLoaded() { 2 django.jQuery(document).ready(function () { 3 if (!django.hasOwnProperty('unitsList')){ 4 django.jQuery.ajax({ 5 url: '/api/v1/courses/units', 6 success: function (data, status, jqXHR) { 7 django.unitsList = data 8 } 9 }); 10 } 11 }); 12 }
59 function domReady(fn){ 60 if(document.addEventListener){ 61 document.addEventListener('DOMContentLoaded',function(){ 62 document.removeEventListener('DOMContentLoaded',this,false); 63 fn(); 64 },false); 65 }else if(document.attachEvent){ 66 document.attachEvent('onreadystatechange',function(){ 67 if(document.readyState=='complete'){ 68 document.detachEvent('onreadystatechange',this); 69 fn(); 70 } 71 }); 72 } 73 }
18 function dom_ready(cb) { 19 function dom_ready_cb() { 20 dom_ready_cb = null_function; 21 cb(); 22 } 23 document.addEventListener('DOMContentLoaded', dom_ready_cb, false); 24 var previous_onload = window.onload; 25 window.onload = function() { 26 dom_ready_cb(); 27 previous_onload && previous_onload(); 28 } 29 }
6 function addOnReady(element, readyCallBack) { 7 element.mounted = function () { 8 this.$nextTick(function () { 9 readyCallBack.call(this); 10 }); 11 }; 12 return element; 13 }
20 function onJqueryLoad() { 21 $(document).ready(function() { 22 $("button").click(function() { 23 setTimeout(function() { 24 // There might be several email windows. Each of 25 // them has a textfield with id em-0, em-1, .. 26 $("div[id^='aD-']").one('click', addSignature) 27 .one('focusin', addSignature); 28 }, 100); 29 }); 30 }); 31 }
551 doc.addEventListener("DOMContentLoaded", function DOMContentLoaded(){ 552 // remove the listener itself 553 doc.removeEventListener("DOMContentLoaded", DOMContentLoaded, false); 554 // assign readyState as complete 555 doc.readyState = "complete"; 556 }, false);