Star rating: Update stars on click and don't lose the actual vote on re-hover
About your HTML:


Consider using the meter element to display the rating:

&lt;meter min="0" max="5" value="3"&gt;★★★☆☆&lt;/meter&gt;


(However, I don’t know how current user agents present this, i.e., if they add some special styling.)
In any case, you should not use the i element for displaying an icon via CSS. Use span instead if you need an empty element.
If you don’t want to use a form for voting, consider using WAI-ARIA to make voting accessible.