Search code examples
javascriptjqueryjslint

JSLint warns that "document" is not fully defined on jQuery(document).ready


I get a

'document' has not been fully defined yet.
    $(document).ready(function () {

warning from jsLint. I get why this happends but I would like my code to be warning free.

My question is - how do I either solve this in code (assign document to itself? var document=document?) or maybe make the warning go away some other way.

Thanks.


Solution

  • I think you can safely ignore that. If you don't want it to show anyway, rewrite it like so

    $(function () {
        // Document is ready
    });
    

    $(function () {}) and $(document).ready(function () {}) are equivalent.