<!DOCTYPE html>
<html>
<body>
<form id="myForm" action="/action_page.php">
<input type="radio" name="sex" id="male" value="male">
</form>
<p>Click the button to create a LABEL element.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("LABEL");
var t = document.createTextNode("Male");
x.setAttribute("for", "male");
x.appendChild(t);
document.getElementById("myForm").insertBefore(x,document.getElementById("male"));
}
</script>
</body>
</html>