I am practicing my JQuery at the moment, and I cannot understand how to make this error message go away: '$' was used before it was defined. The code seems to work though. Nothing wrong with it.
I downloaded the latest version of JQuery, using a Safari browser, and writing my code in the Brackets text editor.
The Javascript code I have is:
$(document).ready(function () {
$("h2").mouseenter(function () {
$("h2").fadeTo('fast', 0);
});
$("h2").mouseleave(function () {
$("h2").fadeTo('fast', 1);
});
});
Below is a screenshot of the my code + error message
You have to tell JSLint it is a global. Add this comment to the top of your file:
/*global $, jQuery*/