kartik-v / bootstrap-star-rating

A simple yet powerful JQuery star rating plugin with fractional rating support.

Home Page:http://plugins.krajee.com/star-rating

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Events are being called multiple time

Doopin opened this issue · comments

commented

I have found 2 similar issues not resolved yet but please excuse of adding adding mine as there is a slight difference.
Am using the version v4.0.5 with JQuery 3.1.1.
I have initialized the plugin after calling livequery plugin (from this author Brandon Aaron) as my star rating input is added on demand when the DOM is already initialized
The whole thing works great with the only exception that events get called so many time. And the number of time they get triggered keeps increasing on the same element when the user interacts with (See the image below).
Please any idea on what could be the reason of this? Any fix?

imgcap

Script used:
$('.langLevel').livequery(function() { $('#langLevel0').rating({ step: 1, min: 0, max: 5, size: 'sm', theme: 'krajee-fa', // clearButton: '', captionElement: "", showCaptionAsTitle: false, starCaptions: {1: 'Beginner', 2: 'Intermediate', 3: 'Advanced', 4: 'Proficient', 5: 'Native'}, starCaptionClasses: {1: 'text-danger', 2: 'text-warning', 3: 'text-info', 4: 'text-primary', 5: 'text-success'} }).on("rating:clear", function(event) { console.info("Your rating is reset"); }).on("rating:change", function(event, value, caption) { console.info("You rated: " + value + " = " + $(caption).text()); }); }, function() { // unmatchFn return; });

Thank you in advance for your assistance

It seems you are registering the plugin multiple times with your third party script - resulting in duplication of events. Either do a proper destroy and reinitialize the plugin - else check the third party script to avoid this issue.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.