I have this simple html generated by Adobe Muse (I can't change it directly):
<div id="randomID" title="counter"><p>1290</p></div>
And I have this options from the CountUp script:
var counter = new countUp( 'counterID', 0, *Some Value*, 0, 2 );
counter.start(); // run counter
The question is:
I need to find ALL elements with title="counter", set ID's for each <p>, then get value from <p>1290</p>, put it into the script options and run each counters separately.
I tries to do this:
var counters={};
$("[title='counter']").each(function(){
counters['counter' + this.id]=$(this).children('p').html(); });
$.each( counters, function( id, value ) {
var id = new countUp( $('#' + id), 0, value, 0, 2 );
id.start();
});
Where I'm wrong?