JSFiddle - React, Tailwind, and code Playground

by Logan Wayne

HTML

<div id="option-div">
    <label><input type="radio">Default Option 1</label><br>
    <label><input type="radio">Default Option 2</label><br>
    <label><input type="radio">Default Option 3</label><br>
</div>
<input type="text" id="new-option" placeholder="Insert New Option">
<input type="button" id="create" value="Create New Equipment">

CSS

label{
  cursor:pointer;  
}

JavaScript

var optiondiv = document.getElementById('option-div');

document.getElementById('create').onclick = function () {

	var input = document.createElement('input'),
      newopt = document.getElementById('new-option').value;
	    label = document.createElement('label');

  newopt = (newopt == '')?'No Entered Text':newopt;

	input.type = "radio";
  input.setAttribute("value", newopt);
  input.setAttribute("checked", true);
	input.setAttribute("name", "radio-name");
  
	label.appendChild(input);
  label.innerHTML += newopt+'<br>';

	optiondiv.appendChild(label);
  
  document.getElementById('new-option').value = '';

};