I have to use an external js file in order to load jquery. The code from my js file is below:
document.write('<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>');
(function($) {
$(document).ready(function() {
alert('it works!!');
});
})(jQuery);
In the firefox firebug console I see this error: "jQuery is not defined" and I think it is because the jQuery library is loaded after the $ function from my js file.
Do you have any idea about how can I fix this? If I run the script from the firebug console everything works fine.