The difference between jquery and $

I used jquery heavily in my php project. But on some page, $ does not work, so I need to use jquery. For instance:

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

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

+8
source share
8 answers

when .noConflict() is called, a selector like $('') no longer works for compatibility with other environments such as Prototype. jQuery('') is being used at this time.

Link: jQuery.noConflict ()

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

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

$ is just a variable that is used for the jQuery alias, and it is a variable, so any one can be assigned to it.

You can get detailed information related to it from the Documentation

+2
source

$ represents a jQuery function and is an alias for jQuery

+1
source

The simplest possible console experiment that illustrates what has already been said:

 ($ === jQuery); //true $.noConflict(); ($ === jQuery); //false 
+1
source

they are the same except $ - ShortForm jQuery in jQuery

0
source

This is a jquery conflict. To solve this problem you should use the correct jquery plugin. use the latest jquery plugin and remove the old code from your code.

0
source

$ is an alias of jQuery in the old version.

In the latest version, if you use this $ , then this function will not be executed.

So, no need to change all the code with jQuery ...

before this code, put:

 var $ = jQuery; 

very simple...

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

All Articles