So I've got a unique problem.
I've got a site that I can't edit the template for at all, I can only alter the embedded script.
This embedded script is injected into the footer of the site in question.
The embedded script relies on $(document).ready to kick itself off.
The problem is, a script higher up on the page throws an error in it's $(document).ready function which prevents my $(document).ready from ever being called.
I tried setting up a try .. catch block, like this, but I believe this will only work if my script is higher up on the page still.
My question, is it possible to get my $(document).ready call to run, even if it's lower on the page, and a previous one has errors?
In the site above my script:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#logo').vAlign();
});
</script>
.vAlign(); is not defined so it's throwing: Uncaught TypeError: undefined is not a function
In my embedded js:
jQuery(document).ready(function() {
console.log('ready!');
});
I never see "ready!" in the console.
jQuery(document).ready(function() { ... })you could simply use(function() { ... })()