Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantic UI rating onRate()

Can someone please give me an example of the onRate() callback function (http://semantic-ui.com/modules/rating.html#/settings) for the rating widget in Semantic UI. I have 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 whether it should be used in javascript or in the div for the rating (<div class="ui rating">. Any help would be gratefully received.

like image 923
Robert Johnstone Avatar asked Sep 18 '14 12:09

Robert Johnstone


People also ask

Is Semantic UI abandoned?

Semantic UI is not dead. There is a community that wants to keep it going. I think it would be helpful to create an RFC repo to discuss future direction of the project and the planning of the implementations of the decisions we make.

Is Semantic UI good?

Semantic UI is similar to Bootstrap in that it uses a component design system but gives you more granular control of the components. You tend to have more modifying classes in Semantic Ui to switch up the styles and looks, and on top of that, Semantic has good support for theming.

Is Semantic UI free?

Semantic UI is a free open source project already used in multiple large scale production environments.

What is Semantic UI in HTML?

Semantic UI is a front-end development framework similar to bootstrap designed for theming. It contains pre-built semantic components that helps create beautiful and responsive layouts using human-friendly HTML.


2 Answers

You have to use the setting API:

$('.ui.rating')
  .rating('setting', 'onRate', function(value) {
      // your amazing code here
  });
like image 121
Ja͢ck Avatar answered Oct 05 '22 12:10

Ja͢ck


Something like this

$('.ui.rating')
    .rating({
        maxRating: 5,
        onRate: function (rating) {
            console.log(rating)
        }
    });
like image 40
Moustafa Elkady Avatar answered Oct 05 '22 11:10

Moustafa Elkady