timyboy12345/Rating.js

Setting the rating value

Closed this issue · 1 comments

How do I set the rating value once the plugin has been initialized?

The only way I see is to call rating() again.

First, the plugin is initialized

$("#stars").rating({
  "stars": 6,
  "click": function (e) {
      alert(e.stars); 
  }
});

Later, call rating() again to set another value:

$("#stars").rating({
   "value": 3
});

This seems to work fine except for the error message that is output when clicking on a star.

Error: No click callback provided!

This is because no click function is passed the 2nd time (which is not necessary, because the click event from the frist initialization is still being triggered.)

Any ideas?

See my pull request: #7