We have code that spits out several script blocks which add identical functions to the queue that gets called when the document is ready. For example:
$(document).ready(function(){
alert('hey');
});
$(document).ready(function(){
alert('hey');
});
$(document).ready(function(){
alert('hey');
});
This is not causing any problems but of course its unnecessary to call the same code several times.
Without changing the code that generates the repeated blocks, is there a way to make jquery only run the first code block and skip the rest?
Keep in mind that there is the possibility that the ready queue has other functions before and after the repeated code.