Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

document is not defined with jshint

Tags:

jshint

In this code:

$scope.others=[some data...]
$scope.tab=[];
$scope.smt = function(x){
        for(var i = 0; i < $scope.others; i++){
            var el = angular.element(document.querySelector('#'+x));
            if (el.hasClass("myClass")){
                sel.push($scope.tab[i]);
            }
        }
}

JSHint complains about:

'document' is not defined

like image 512
Jeroj82 Avatar asked Nov 26 '15 18:11

Jeroj82


1 Answers

Add "browser" : true to your jshint configuration or /* jshint browser: true */ at the top of your file to let jshint know that your environment is a browser. See documentation

like image 92
huysentruitw Avatar answered Nov 05 '22 03:11

huysentruitw