I'm having a problem with IE8 throwing an "object expected" error when loading a page with the jquery command $(document).ready()
. I've gone through all the other posts I can find here on SO, and none of the solutions seem to work.
To troubleshoot, I created the following html, which runs fine in Firefox and Chrome, but produces an "object expected" error at the $(document).ready
line. So far:
<head>
(I've included it in the body to recreate the situation on the site I'm developing on)jQuery(document)
instead of $
- same resultvar $j=jQuery.noConflict();
and including $j(document)
, getting a 'jQuery is undefined' error on the $j
declaration.What am I missing? ANY help is appreciated! Thanks!
<html>
<head>
<script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
alert("WORKING!");
});
</script>
<div id="test">
</div>
</body></html>
Mate, check your two script tags. One says type="application/javascript"
, the other says type="text/javascript"
.
Change the first one to type="text/javascript"
and it will work fine.