Home/Jquery/What is $ in Jquery?

What is $ in Jquery?

What is $ ?

  • In jQuery, $ is an alias for jQuery. From the above statement we can able to understand, function are available without using $.
  • If you need to use another JavaScript library along side with jQuery,  then it will return control of $ back to the other library with a call to $.noConflict().
  • if noConflict() is used than the references will be restored.

Is possible to change $ symbol?

Yes, we can use any alias name instead of $, by changing the below line

// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;

where jQuery on the right side is the function-scoped reference.

This will be available in jquery plugin. if u want to change it to JQ then we want to change like below

// Expose jQuery to the global object
window.jQuery = window.JQ = jQuery;

after library loaded in your application you can use JQ instead of $.

 

READ  Query append() VS appendTo()

Keep Cool Coding…

 

Leave A Comment