Jquery and Jslint - '$' was used before it was defined

I have some third party javascript im working with, I added some jquery code into it the javascript file. But it seems to fail on the above code when validating using Jslint

'$' was used before it was defined.

I can see at the top of the javascript file it states:

/*global alert: false, console: false, jQuery: false */

Im relatively new to Javascript, and JQuery, so any help would be welcome.



Add these options to your comments:

/*jslint browser: true*/
/*global $, jQuery, alert*/

If you want to use variables provided by other scripts, then you need to say so:

/*global $ */

For JSLint In Netbeans IDE go to:

Tools - Options - Miscellaneous - JSLint tab - Text area under "Predefined (, separated)":

  • add $;
  • add your other project global variables, separating with comma.

Now JQuery variable $ is considered defined everywhere in code.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.