Krajee
Thankful to Krajee! BUY A COFFEEor to get more out of us.

The plugin supports the following methods. Many of the methods below support method chaining because they return the star rating input element as a jQuery object.

Tip

Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)

update

Update the rating by setting a value via javascript. The method accepts a rating value as a parameter. This method returns the rating input element as a jQuery object and can thus be chained with other methods.

$('#input-id').rating('update', 3);

// method chaining
var ratingValue = $('#input-id').rating('update', 3).val();

refresh

Use this method to dynamically refresh the rating options via javascript after the plugin has been initialized. The method accepts the plugin options entered as an object (associative array). This method returns the rating input element as a jQuery object and can thus be chained with other methods.

// Example: Call the method below in rating:change event to disable the rating and
// hide the clear button.
$('#input-id').rating('refresh', {disabled: true, showClear: false, showCaption: true});

// method chaining
var ratingValue = $('#input-id').rating('refresh', {
    disabled: true,
    showClear: false,
    showCaption: true
}).val();

reset

Reset the rating to the initial value. For example after a form reset. This method returns the rating input element as a jQuery object and can thus be chained with other methods.

$('#input-id').rating('reset');

// method chaining
var ratingValue = $('#input-id').rating('reset').val();

clear

Clear the rating. This method returns the rating input element as a jQuery object and can thus be chained with other methods.

$('#input-id').rating('clear');

// method chaining
var ratingValue = $('#input-id').rating('clear').val();

destroy

Destroys the rating. This method returns the rating input element as a jQuery object and can thus be chained with other methods.

$('#input-id').rating('destroy');

// method chaining
var ratingValue = $('#input-id').rating('destroy').val();

create

Creates the rating after destroying any existing rating plugin instance. This method returns the rating input element as a jQuery object and can thus be chained with other methods.

// will re-create rating based on initial plugin options
$('#input-id').rating('create');

// method chaining
var ratingValue = $('#input-id').rating('create').val();

// any new plugin options if passed will be used instead of initial plugin options
$('#input-id').rating('create', {disabled: true});

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Jquery Plugins since 22-May-2017