<!DOCTYPE html>
<html>
<body>

<form>
  <label id="myLabel" for="male">Male</label>
  <input type="radio" name="sex" id="male" value="male"><br>
</form>

<p>Click the "Try it" button to change the value of the for attribute of the label.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    document.getElementById("myLabel").htmlFor = "newValue";
    document.getElementById("demo").innerHTML = "The value of the for attribute was changed from 'male' to 'newValue'.";
}
</script>

</body>
</html>