How to add jQuery.noConflict() to js file

Sometimes we are using different names of main jQuery function, i mean $ and jQuery. Finally it causes some errors with js code due to name differenses. we can prevent it using this construction jQuery.noConflict(). I will show in details how we should do it. 

(function($) { 
  $(function() {
      jQuery(document).ready(function() {
	//here we do what we need

its very easy. now we can write $ and jQuery, now it doesn't matter. More over this wonderfull construction is used to prevent confict between different js libraries. Continue doing Drupal! Good luck!

0 out of 10 based on 0 ratings.