Radio buttons are used when you want to let the user select only ONE option from a set of alternatives. For this to work, related radio buttons must have the same name to identified them as a group. e.g.
<form>
<input type="radio" name="gender" value="male" checked>Male
<br>
<input type="radio" name="gender" value="female">Female
</form>
If you wan to assign name attribute to the radio button group programmatically, try this:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("input:radio").attr("name","gender");
});
</script>
</head>
<body>
<form>
<input type="radio" value="male" checked>Male
<br>
<input type="radio" value="female">Female
</form>
</body>
</html>