OnRate () UI semantic rating

Can someone please give me an example callback function onRate()

( http://semantic-ui.com/modules/rating.html#/settings ) for the rating widget in the semantic interface. I tried everything :(

$('.ui.rating').rating('onRate(rating_changed())');
$('.ui.rating').rating().onRate(rating_changed());
$('.ui.rating').rating().onRate('rating_changed()');
etc ...

      

I don't know if it should be used in javascript or in a div for the rating ( <div class="ui rating">

. Any help would be greatly appreciated.

+3


source to share


2 answers


You have to use the settings API :



$('.ui.rating')
  .rating('setting', 'onRate', function(value) {
      // your amazing code here
  });

      

+11


source


Something like that



$('.ui.rating')
    .rating({
        maxRating: 5,
        onRate: function (rating) {
            console.log(rating)
        }
    });

      

+2


source







All Articles