Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 363
Ben Avatar asked Aug 17 '11 09:08

Ben


2 Answers

You can simply use

/*jslint browser:true */

in the beginning of the code to assume a browser.

like image 110
Jayantha Lal Sirisena Avatar answered Sep 28 '22 05:09

Jayantha Lal Sirisena


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.

like image 32
Emil Ivanov Avatar answered Sep 28 '22 04:09

Emil Ivanov