Why cant Dollar symbol be used as an alternative fo jQuery in Wordpress?

前端 未结 3 873
难免孤独
难免孤独 2020-12-17 22:27

Why can\'t we use \"$\" instead if jQuery in wordpress? Usually \"$\" is the alternative of jQuery right? But in Wordpress it shows \"$\" is not a function.

3条回答
  •  旧巷少年郎
    2020-12-17 22:53

    The tricky thing is this particular copy of jQuery is in compatibility mode by default. That means that the typical ‘$’ shortcut for jQuery doesn’t work, so it doesn’t conflict with any other JavaScript libraries that use the dollar sign also, like MooTools or Prototype.

    Source: Using ‘$’ instead of ‘jQuery’ in WordPress

提交回复
热议问题