MoreLesson 184Free preview
User Rating
This lesson is part of How To · All levels
Summary
This lesson discusses the interactive rating components that allow users to rate by clicking on a star. JavaScript handles the selection of values, displays average ratings, and can display half-star support. Feedback after assessment and accessible labelling make the components more clear and inclusive.
Key points
- Save the rating value on the hidden data-value attribute or input element
- Display confirmation after the user has selected to make his actions appear obvious
- Calculate the mean of the set of values and round it up according to the display requirements
- Use a button with the air-labels for each star to access the keyboard
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.