I’m using the Foundation CSS framework, which loads jQuery in the footer. This is not atypical and recommended practice by many. However, I need to write scripts in the page. Using document ready should do the trick, but I’m still getting an error. Why?
$(document).ready(function(){
// My Code
var a;
$(#id).dosomething({
// Doing Something
});
});
Just before body close tag:
<script src="scripts/jquery-1.8.0.min.js"></script>
// More Scripts
</body>
But I get the standard error “Uncaught ReferenceError: $ is not defined” (4x because I have 4 scripts in the body). Also, I cannot move the jQuery reference above the script call as it conflicts with other scripts. I cannot move the script call below jQuery reference either.
I think you misunderstood. You use
$(document).readyto register code that should be executed once the DOM is read, which is typically when you want to manipulate the DOM.$is jQuery here, so obviously it has to be loaded before you call$(document)....Maybe you should use
jQuery.noConflict()[docs] then.