$(function() { $("canvas[data-chart]").each(function() { var object = $(this).data("chart"); var chart = new Chart(this, object); }); });