Here's my current code:
<div class="form-control-switch-option">
<input type="radio" data-value="Buy">
<label class="form-control-switch-option-label text-color__dark btns-family">For Sale</label>
</div>
<div class="form-control-switch-option">
<input type="radio" data-value="Buy" checked="checked">
<label class="form-control-switch-option-label text-color__dark btns-family">For Sale</label>
</div>
What I'm wanting to do is add the class "working" to the parent element (form-control-switch-option) whenever the input element is checked. So, based on the example above, it should become this:
<div class="form-control-switch-option">
<input type="radio" data-value="Buy">
<label class="form-control-switch-option-label text-color__dark btns-family">For Sale</label>
</div>
<div class="form-control-switch-option working">
<input type="radio" data-value="Buy" checked="checked">
<label class="form-control-switch-option-label text-color__dark btns-family">For Sale</label>
</div>
Is there any way to do this with pure Javascript (not jQuery)?
checkedis automatically selected a lot of the time.