Submitting a Rating

The Rating control raises three events: preview, cancel, and change. The preview event is raised when you hover over a star. The cancel event is raised when you don’t select a star after hovering over it. Finally, if you click a star, the change event is raised.

The page in Listing 4.7 contains a rating control and a DIV element. When you change the product rating, or even when you are considering changing the rating for the product, the message displayed in the DIV element is updated.

LISTING 4.7 Handling Rating Control Events (ratingSubmit\ratingSubmit.html)

<h1>Rate our Store!</h1><div id="ratingStore"    data-win-control="WinJS.UI.Rating"    data-win-options="{        maxRating: 3    }"></ ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.