JSFiddle - React, Tailwind, and code Playground

HTML

<input id="theCheckboxId" type="checkbox" name="theCheckBoxName" />
<label id="lbl1" for="XXX">The text I want to change</label>

JavaScript

document.getElementById("lbl1").setAttribute("for", "theCheckboxId");