How do I apply animations for previously selected Item

I have a radio button and able to get the action/ animations on button click. And how I add an animation for the previously selected Item from the radio button group.

Code is given blow,

function radiobtn_clicked(radiobtn){ console.log(radiobtn.value) }
.toggle-triple-switch label {         display: inline-block;         height: 30px;         width: 50px;         position: relative;         border: 2px solid;         justify-content: center;             }       .toggle-triple-switch .toggle-triple-switch__input:checked + .toggle-triple-switch__label{         color: #FFFFFF;        background-color: green;        transform: scale(1);     }
    <div class="toggle-triple-switch" id="time-selector" dir="auto">      <input type="radio" id="time-now"class="toggle-triple-switch__input" name="time-select" value="now"         checked onclick="radiobtn_clicked(this)"/>        <label for="time-now" class="toggle-triple-switch__label" id="now-label"></label>              <input type="radio" id="time-yesrtay"  class="toggle-triple-switch__input" name="time-select" value="yesterday"      checked onclick="radiobtn_clicked(this)"/>     <label for="time-yesrtay" class="toggle-triple-switch__label" id="ysterday-label"></label>             <input type="radio" id="time-tomorrow" class="toggle-triple-switch__input" name="time-select" value="tomorrow"      checked onclick="radiobtn_clicked(this)"/>     <label for="time-tomorrow" class="toggle-triple-switch__label" id="tomorrow-label"></label>      </div>

Sample code in Jsfiddle

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.