What is the difference between a dollar sign and a dollar sign followed by a period in JQuery?

前端 未结 5 1584
余生分开走
余生分开走 2021-01-12 10:48

In jQuery, what is the difference between $ and $.? Please provide a practical explanation if possible.

5条回答
  •  天涯浪人
    2021-01-12 11:23

    In the context of jQuery, $ refers to the global jQuery object.

    $. by itself is invalid JavaScript. As $ is an object, methods on this object are called like on any other object: $.methodname().

    Maybe it becomes clearer by substituting $ with jQuery: jQuery.methodname().

提交回复
热议问题