Himanshu Pandey
Himanshu Pandey

Reputation: 1270

Difference between jquery and $

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

Answers (8)

Alexey Mitrofanov
Alexey Mitrofanov

Reputation: 61

The simplest possible console experiment which isslustrates what has already been told:

($ === jQuery); //true
$.noConflict();
($ === jQuery); //false

Upvotes: 2

$.ajax({
    url: 'Emp.asmx/getDesignation',
    type:'post',
    contentType: 'application/json;charset=utf-8',
    dataType: 'json',
    data: "{}",
    aync: false,

Upvotes: -3

sankar
sankar

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

robasta
robasta

Reputation: 4701

The $ represents the jQuery Function, and is an alias for jQuery

Upvotes: 2

Sachin
Sachin

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

Raptor
Raptor

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

Nirmal
Nirmal

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

XTGX
XTGX

Reputation: 114

these are same except $ is ShortForm of Jquery in Jquery

Upvotes: 0

Related Questions