henri_1310
henri_1310

Reputation: 315

Convert a jquery to a jquery noConflict

I have this piece of javascript code and I must convert it with jquery noConflict in order to make it work with wordpress jquery. Do you have any clue to do this?

var initCharts = function() {
var charts = $('.percentage');
  charts.easyPieChart({
    animate: 2000
  });
}

Thanks for your help

Upvotes: 1

Views: 918

Answers (2)

coder
coder

Reputation: 13248

$.noConflict();


(function($) { 
  $(function() {
    // more code using $ as alias to jQuery
  });
})(jQuery);
// other code using $ as an alias to the other library

Based on your code:

(function($){
    $(document).ready(function() {
      var initCharts = function() {
      var charts = $('.percentage');
      charts.easyPieChart({
      animate: 2000
      });
    } 
  });
})(jQuery);

Upvotes: 0

AlexC
AlexC

Reputation: 9661

http://api.jquery.com/jQuery.noConflict/

jQuery.noConflict();
(function($) {
  $(function() {

var initCharts = function() {
var charts = $('.percentage');
  charts.easyPieChart({
    animate: 2000
  });
}

  });
})(jQuery);

Upvotes: 2

Related Questions