Reputation: 1270
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
});
Can anybody please tell me what is the difference between $ and jquery?
Upvotes: 8
Views: 13930
Reputation: 61
The simplest possible console experiment which isslustrates what has already been told:
($ === jQuery); //true
$.noConflict();
($ === jQuery); //false
Upvotes: 2
Reputation: 1
$.ajax({
url: 'Emp.asmx/getDesignation',
type:'post',
contentType: 'application/json;charset=utf-8',
dataType: 'json',
data: "{}",
aync: false,
Upvotes: -3
Reputation: 61
$
is an alias of jQuery in old version.
In latest version if you're using this $
then that function will not execute.
So, no need to change the entire code with jQuery...
before that code, put:
var $ = jQuery;
very simple...
Upvotes: 0
Reputation: 40970
$
is just a variable that is used to alias jQuery
and it is a varible so anything could be assigned to it.
You can get detailed information related to it from its Documentation
Upvotes: 3
Reputation: 54212
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.
Reference: 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>
Upvotes: 11
Reputation: 2368
It's a jquery conflict. You should use a correct jquery plugin to solve this problem. use a latest Jquery plugin and remove the old one from your code.
Upvotes: 0