JSHint and jQuery: '$' is not defined

前端 未结 9 2113
青春惊慌失措
青春惊慌失措 2020-12-07 07:13

The following JS:

(function() {
  \"use strict\";

  $(\"#target\").click(function(){
    console.log(\"clicked\");
  });

}());

Yields:

9条回答
  •  执笔经年
    2020-12-07 08:04

    If you're using an IntelliJ editor, under

    • Preferences/Settings
      • Javascript
        • Code Quality Tools
          • JSHint
            • Predefined (at bottom), click Set

    You can type in anything, for instance console:false, and it will add that to the list (.jshintrc) as well - as a global.

提交回复
热议问题