7
I am creating a registration form, in it I will insert a voting system, I wanted to do that when clicking on some star, the previous ones will change color too. (Follows the code I created)
<div class="vote">
<label>
<input type="radio" id="cm_star" name="fb" value="1" />
<i class="fa"></i>
</label>
<label>
<input type="radio" id="cm_star" name="fb" value="2" />
<i class="fa"></i>
</label>
<label>
<input type="radio" id="cm_star" name="fb" value="3" />
<i class="fa"></i>
</label>
<label>
<input type="radio" id="cm_star" name="fb" value="4" />
<i class="fa"></i>
</label>
<label>
<input type="radio" id="cm_star" name="fb" value="5" />
<i class="fa"></i>
</label>
The result in image:
What is the problem you are facing? what is missing to work?
– rray
I suggest you use a plugin for this, it is easier than doing from scratch. these here for example. https://css-tricks.com/star-ratings/, http://speckyboy.com/2010/04/21/15-javascript-and-plugins-and-tutorials-for-adding-ratings/, http://www.sitepoint.com/10-jquery-rating-plugins/, http://wbotelhos.com/raty
– PauloHDSousa
I want the old ones to change colors too, like, click on the 4 star at 3, 2 and 1 also change colors.
– Leno Sousa