I have 10 buttons in one HTML page. I want to use JavaScript to change particular button (button 1) color when button is selected. When user click another button (button 2) the color of that button is should change and first selected button (button 1) should be deselected.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
You can define a different CSS class for selected button.
Then when a button is clicked, you can call the function like this:
Add this to HTML