Reputation: 2153
I've an error with FlipClock.js when I try to get event with on method.
My code:
var counter = $('.counter').FlipClock(0, {
clockFace: 'Counter',
minimumDigits: 3
}).on('set:time', function() {
alert('test');
});
I have this on console:
Uncaught TypeError: $(...).FlipClock(...).on is not a function
Upvotes: 0
Views: 2768
Reputation: 1263
By looking into your jsfiddle example, I can see that you do not react on the jQuery element.
I have tested your code with following changes:
$(document).ready(function () {
var counter = $('.counter').FlipClock(0, {
clockFace: 'Counter',
minimumDigits: 3,
events: true
});
counter.$el.on('set:time', function() {
alert('test event');
});
$(document).on('click', 'button', function () {
alert('Set!');
counter.setTime(10);
});
});
This works perfectly!
In my correction of the, I am listening on the event by the jQuery element.
Please vote and approve the answer.
Upvotes: 0