jquery reset rating

Jun 7, 2012 at 1:52 AM

Trying to reset the rating with jquery.

<input type="hidden" value="" name="rating" id="rating">
<div class="rateit" id="editrate" data-rateit-backingfld="#rating" data-rateit-resetable="false"  data-rateit-starwidth="32" data-rateit-starheight="32">

I've tried the following without luck.

$('#editrate').rateit('value', null);

$('#editrate').rateit('value', 0);

Is there any way to reset rateit without the user doing it manually?

Coordinator
Jun 8, 2012 at 6:34 AM

Hi ,

I see you found a bug... For now the workaround is:

$('#editrate').rateit('value', '0');

So enter a string instead of a number. This is only when setting it to zero, the other numbers do work correctly.

I will try to fix it ASAP.

Gidon

Coordinator
Jun 8, 2012 at 2:23 PM

I created a workitem : http://rateit.codeplex.com/workitem/634

Jun 8, 2012 at 2:32 PM

Thanks!  Also, if it could accept a Null or include a equivalent Reset, that would be nice.  I can certainly code that a value of 0 is equivalent to a null or No Rating, but not sure if that is the same for everyone.  The default is null so it would be nice to set it back to that.

Coordinator
Jun 8, 2012 at 3:15 PM

Done, just download 1.0.5, and use:

$(SELECTOR).rateit('value', null);

The default value is not exactly null, it defaults to the "min" value. Whether that is correct is another issue, which if need arises, I'm more than willing to discuss.

Anyway I do think you are right that setting the value to null is a nice way to resetting the value (since one can change the min value, so that 0 is not always the 'start' value)

Have a nice day,

Gidon