Search.../

rating

Sets or gets the displayed rating.

Description

Setting the rating property sets how many icons are displayed in the on state and what value to show textually if the element is set to show a textual value.

Set the rating value to a number between 1.0 and 5.0 to display a rating. The textual value, if set to show, will display the rating value to the nearest tenth and the rating icons will round that value to the nearest half icon. For example, if you set rating to 4.24, it will be shown textually as 4.2 and 4 stars will be displayed in the on state. However, if you set it to 4.25, it will be shown textually as 4.3 and 4 and a half stars will be displayed in the on state.

To reset the ratings display element, restoring it to the empty state, set the rating property to null or undefined.

Getting the rating property returns the current displayed rating.

Type:

numberRead & Write

Was this helpful?

Get the displayed rating

Copy Code
1let rating = $w("#myRatingsDisplay").rating; // 2.5
Set the displayed rating

Copy Code
1$w("#myRatingsDisplay").rating = 2.5;