Search code examples
javascriptjqueryuse-strict

What's the proper way to use jQuery in conjunction with 'use strict'?


If I have something like the following

"use strict";

$(document).ready(function () {

});

I get the warning

'$'is not defined

Solution

  • ( function ( $ ) {
        'use strict';
        $( document ).ready( function () {
            console.log( 'working!' )
        })
    } ( jQuery ) )