Q: Removing/Inserting UI element in Shiny I'm having an annoying problem at the moment, I have created an observeEvent({}) to add/remove some UI elements based on alternating clicks of a button, however after the element is added, a subsequent click of the button fails to remove it.
    server <- function(input, output,session) {
global <- reactiveValues(add.A = FALSE)
 observeEvent(input$add.A,{
global$add.A = !global$add.A
if(global$add.A){
  insertUI(
  selector = "#heading",
  where = "afterEnd",

  ui =  div(id = "alleles.A",
          fluidRow(
            column(width=6,
              div(div(class="ddown",uiOutput("Recipient.HLA.A.1")),div(class="ddown",uiOutput("Recipient.HLA.A.2")))
            ),
            column(width=6,
              div(div(class="ddown",uiOutput("Donor.HLA.A.1")),div(class="ddown",uiOutput("Donor.HLA.A.2")))
          )
         )
       )
     )
    }else{
      removeUI(selector = "#alleles.A")
    }
  })
}  

