title: Hide one radio button from the group dynamically created from Javascript
body: <p>I asked this question earlier but the post was not coherent or clear. So here we go again.</p>
  
  <p>We dynamically generate a page using Javascript. This part of the code is used to create a set of radio buttons:</p>
  
  <pre><code>Dead, Trans, Hospital, Removed
  </code></pre>
  
  <p>Now I need to hide the radio button "Removed" when it's unchecked and only show the other 3. Javascript code:</p>
  
  <pre><code>//Create the main RadioDiv and append radio options
  var radioQuestion = document.createElement("div");
  radioQuestion.setAttribute("id", name + "RadioDiv");
  fsRadio.appendChild(radioQuestion);
  //For each radio button option do the following
  for (var d = 0; d &lt; optionList.length; d++) {
      var name = optionList[d].name;
      var value = optionList[d].value;
      //This creates the input field for each option
      var radioItem = document.createElement("input");
      radioItem.setAttribute('type', "radio");
      radioItem.setAttribute('name', flId);
      radioItem.setAttribute('id', flId + "_" + name);
      radioItem.setAttribute('value', value);
  
      if (flId != null &amp;&amp; flId === 'reasonCode' 
          &amp;&amp; name != null &amp;&amp; name === 'Removed') {
           console.log("radio::"+flId + "_" + name);
           //Code to hide the button here?
      }
  
      if (status === null || status === "" ||
          status === false ||
          typeof status === 'undefined') {
          radioItem.setAttribute('class',
              "inactive-field");
          radioItem.setAttribute('disabled', "disabled");
      } else if (status === true) {
          radioItem
              .setAttribute('class', "active-field");
      }
  
      //This creates the label
      var radioLabel = document.createElement("label");
      radioLabel.setAttribute('for', flId + "_" + name);
      radioLabel.textContent = name;
      var objDiv = document.createElement("div");
      objDiv.setAttribute('class', "q-radio");
      objDiv.appendChild(radioItem);
      objDiv.appendChild(radioLabel);
      //Append all radio buttons to the main RadioDiv - radioQuestion
      radioQuestion.appendChild(objDiv);
      if (radioItem.value == flValue &amp;&amp; flValue != null &amp;&amp; flValue != undefined &amp;&amp; flValue != "") {
          radioItem.setAttribute('checked', "checked");
      } //end of if statement
  
  } //end of For loop
  </code></pre>
  
  <p>Hopefully this time the post is relevant. Thanks so much for your help. Also if any more details needed, please do let me know.</p>
  
  <p>Thanks</p>