Passing $ in jQuery function. What's the use of $ sign? -
this question has answer here:
as title says, kindly explain use of $ sign in functoin. using code smooth scroll id in wordpress.
when remove $ sign, code not work. have pass $ in function. kindly refer image.
note: code works without passing $ in function when using in html website not work in wordpress. well, nothing worry if 1 explain?
below code:
$(document).ready(function($){ $('.scroll').on('click',function (e) { e.preventdefault(); var target = this.hash; var $target = $(target); $('html, body').stop().animate({ 'scrolltop': $target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); }); });
the $
name of variable. equivalant jquery
variable. assume code:
var $ = "my $ variable"; alert ($);
no magic it, name.
Comments
Post a Comment