Feature request: a .reset() method to clear out everything

Aug 19, 2013 at 10:52 PM
It would be nice if there was a way to completely and programmatically reset a RateIt instance back to its initial state. I currently have 'resetable' set to false, but it looks like the code that's fired when the reset button is clicked wouldn't even do what I want. I need things like 'readonly' and 'ispreset' set back to their default values.

My suggestion would be to do the event handling like jQuery itself. For example, provide a .reset() method that binds the event if you pass in a callback, or triggers the event if you call it with no parameters.

Right now, the easiest way to completely reset RateIt is to remove the element from the DOM, create a new element on the fly, and then initialize a new RateIt instance on that newly-created element. While this isn't absolutely terrible, it seems like there should be an easier way to do it.
var $exampleRateIt = $("#exampleRateIt");

if ($exampleRateIt.length) {
    $exampleRateIt = $("<div id='exampleRateIt'></div>");

    resetable: false,
    step: 1,
    min: 0,
    max: 5
Aug 20, 2013 at 6:40 AM
You're right. The fact that it doesn't return to the initial state is a bug.
Having the option to programmatically reset the control would indeed be a nice feature.

I'll put it on the list for the next release. I hope I will get it out it the next week or so.

Nov 7, 2013 at 1:14 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 10, 2013 at 7:35 AM
In version 1.0.14 it will be possible to call $('XXXXX').rateit('reset') to invoke the reset, which reverts to the initial state.
Nov 12, 2013 at 6:44 PM
Hi gidon, sorry to hijack your thread but when you make your next release please add the attribute data-role="none" when you create your internal <button element in your js code. This will ensure that your library works well with jquery mobile. thanks.