JSLint - $ was used before it was defined

in JavaScript, jQuery, JSLint

I'm using JSLint to validate my JavaScript. For no other reason, it keeps things consistent. However, I get the below warning message when performing a $(document).ready(...) call:

'$' was used before it was defined

To get around this, I pass jQuery in, assign it to $, and set my JSLint options. Below is an example usage:

/// <reference path="../../Scripts/jquery-1.7.2.js" />
/*jslint browser: true*/

(function ($) {
    "use strict";
    /*global jQuery, document*/
    
    $(document).ready(function () {
        $('#RequiredFieldIndicator').show();
    });
}(jQuery));

Comments