$(document).ready is redundant in self invoking functions

One of my item is soft rejected due to this issue. How can I solve this.
$(document).ready is redundant in self invoking functions.

(function ($) {
“use strict”;
$(document).ready(function(){

Can I write this by this way:
(function ($) {
“use strict”;
$(function(){

Or can you please tell me, the proper way to declare this.

wrap all your code into

 jQuery(document).ready(function($) {

"use strict"

...your code here...

});

No need for an extra scope inside this function and if you use “use strict” you will not be able to create variables in the global namespace

1 Like