I have been trying to change the data value inside a label, but I can see that setAttribute actually changes the value from the input by adding the data-checked and data-unchecked.
<div>
<input type="checkbox" class="toggle" id="default" name="default">
<label for="default" data-checked="Checked" data-unchecked="Unchecked"></label>
</div>
This is the javascript that I'm trying to run. Is there a way to modify the label instead of the input?
document.getElementById("default").setAttribute("data-checked","Active");
document.getElementById("default").setAttribute("data-unchecked","Inactive");
Thanks!