Closed bizarrochris closed 9 years ago
You are right. The rating is initialized twice, the first due to the implicit auto-initialization of all the .rating
inputs and the second with the explicit $('input.rating').rating()
initialization.
I have added a flag to prevent against multiple initializations.
PS: Currently all those inputs marked as .rating
are implicitly initialized. However, I still have some doubts if the plugin should implicitly auto-initialize all those inputs marked as .rating
or not.
Thanks for the feedback.
Wow! Thanks for the fast response. Will update my project immediately. I would suggest removing auto initialization as I think most of the jquery or jqueryui stuff, like e.g. datepicker etc also need to be explicitly called and it gives the user more control. However, the flag is still useful in case of ajax calls etc, where one might reinitialize the rating twice on accident.
Cheers!
When explicitly calling $('input.rating').rating(); the bootstrap-rating is initialized twice.
Is this a desired behavior? A workaround is setting a different class. If this is planned I would propose adding this to the doku.
Another solution would be adding a param: e.g. $.fn.rating.defaults.autoInit = false;
Cheers bizarrochris