First on:
The default "Today" is the checked state, which is the inline style:
<button type= "button" id= "Today" class= "Btn-link" onclick= "TodayDate ()" style= "color: #0062CC;" > Today </button>
The above dates are all clicked to toggle the color:
- Click Other colors, "Today" color change to Gray
- Click "Today" again to revert back to the default state color
- Add a click event to any date other than "Today" to "change" today's default color state
- Add "Restore" today's default state color to the "Today" click event
//Yesterday clickfunctionyesterdaydate () {document.getElementById (' title '). Value = Getyesterdaydate (NewDate ()); Fetyesterdaydata (); Today.css ( ' color ', ' #555555 ');}//Today clickfunctiontodaydate () {document.getElementById (' title '). Value = Formatterdatestr (NewDate ()); Fettodaydata (); Today.css ( ' color ', ' #0062cc ');}
OK, Finish.
Simple JS control button color with click to change