I am learning jQuery for the last two days and I am stuck with this weird issue with Opera v 10.60 on Mac. I like to follow good development guidelines and therefore keep presentation(css), content and behavior (JavaScript) portions separate for any website I write.
The head portion of my test html page has two script tags -
- First one to include the jQuery library on Google's CDN (http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js) and
- The second one is my own JavaScript file where I am trying out things using jQuery, I call this myScript.js.
The Problem:
I have JavaScript enabled on Opera, yet none of my JavaScript would load. However, if I put the actual script (rather than specifying myScript.js in the src attribute of the script tag) inside the script tag in the head element, everything works fine. Which means I am loading the jQuery library off Google CDN fine, but not the relatively referenced (that is, not absolute) JavaScript file that is inside the same folder as my html file.
Neither Firefox nor Safari (on Mac and Windows) has any problem at all loading an external relatively-referenced JavaScript file, it's just Opera.
Any help will be highly appreciated. Thanks.
Problem solved
Thanks for the help... I looked back at the html and saw that I was using the script tag incorrectly.
I had it like this,
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/>
<!-- my JavaScript - Note you must have included jQuery before calling own js -->
<script type="text/javascript" src="myScript.js" />
Whereas it should be,
<script type="text/javascript" src="myScript.js"></script>
Will be more careful in the future and will also post the script or link to page when asking questions in the future.