Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
$.fn.counter = function(options) { return this.each(function() { // Prevent double-init if ($(this).data("counter")) return; const instance = new Counter(this, options); $(this).data("counter", instance); }); }; // Later, access instance $(".count-box").counter({ start: 0, end: 100 }); $(".count-box").data("counter").pause();
Result
Open