javascript - Dollar sign ("$") is not a function -
i'm unsure of why i'm getting error, reason jquery's $ not being recognised?
jquery(window).load(function ($) { 'use strict'; /* preloader */ $(".status").fadeout(); $(".preloader").delay(1000).fadeout("slow"); }); /* end widnow load */ note: changing $ jquery fixes issue (so i'm sure jquery referenced correctly, using version 2.1.4), continue using $ semantics.
you overriding $ variable inside function, because have argument same name.
remove $ argument , $ again refer global scoped one, equal jquery.
jquery(window).load(function () { 'use strict'; /* preloader */ $(".status").fadeout(); $(".preloader").delay(1000).fadeout("slow"); }); /* end widnow load */ you can use parameter handler function passed load. suggest same anik islam abhi's answer: use name argument. example e or eventargs.
note (or others landing here) might trying use pattern makes sure jquery available $ inside scope (e.g. because there may conflict library declaring $ in global scope). if that's case, suggest along these lines:
(function($) { $(window).load(function () { 'use strict'; /* preloader */ $(".status").fadeout(); $(".preloader").delay(1000).fadeout("slow"); }); /* end widnow load */ }(jquery)); this wrap code inside function executed jquery passed in argument. because $ name of argument of function, you'll know sure $ equal global jquery within function's scope.
Comments
Post a Comment