I've had challenges with keeping track of the toggled state, say If I triggered an onmousedown event on a div element. I need to remove that event as soon as I've triggered the event to another div, that way I won't have more than 2 active divs. thanks
GeorgeMan
@CuriousoCharlieAll comments
- @hakizimana-fredSubmitted about 2 years ago@CuriousoCharliePosted about 2 years ago
I noticed your submit button doesn't change colors when you click it. This can be solved by using button:active in css and adding applicable styles there. They'll display as its being clicked. As for dealing with the rating numbers themselves in javascript, I opted to have a variable that keeps track track of the last rating clicked. Initially set to -1, when a user clicks a rating, the previous rating variable will be set to what is clicked. Then if another rating is chosen, you can deal with the previous rating. You can check my solution. While I'm sure there are better ways of doing it, it gets the job done.
Marked as helpful0