jQuery和$之间的区别 [英] Difference between jquery and $

查看:122
本文介绍了jQuery和$之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的php项目中大量使用了jquery.但是在某些页面上,$无法正常工作,因此我必须使用jquery.例如:

I did heavy use of jquery on my php project. But on some page the $ is not working, so I have to use jquery. For example:

jQuery('#mycarousel').jcarousel({
start: 3
});

有人可以告诉我$和jquery有什么区别吗?

Can anybody please tell me what is the difference between $ and jquery?

推荐答案

在调用.noConflict()时,像$('')这样的选择器将不再起作用以确保与其他框架(例如Prototype)的兼容性.当时使用的是jQuery('').

when .noConflict() is called, selector like $('') is no longer working to ensure compatibility with other framework such as Prototype. at that time jQuery('') is used instead.

参考: jQuery.noConflict()

为了更好地说明这个想法,以下是从参考链接获得的示例:

To better illustrate the idea, here is an example obtained from the reference link:

<script type="text/javascript">
  $.noConflict();
  jQuery(document).ready(function($) {
    // Code that uses jQuery's $ can follow here.
  });
  // Code that uses other library's $ can follow here.
</script>

这篇关于jQuery和$之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆