title: R shinyjs shinydashboard box uncollapse on radionButtons input
body: <p>Based on this question <a href="https://stackoverflow.com/questions/49659804/r-shinyjs-shinydashboard-box-uncollapse-on-action-button-input">R shinyjs shinydashboard box uncollapse on action button input</a> and question <a href="https://stackoverflow.com/questions/32104918/how-to-manually-collapse-a-box-in-shiny-dashboard">How to manually collapse a box in shiny dashboard</a>, I would like to substitute the <code>actionButton</code> with the <code>radioButtons</code> (or <code>selectInput</code>). Below a reproducible example. When I click yes I want box id=B2 and id=B3 to collapse, when I click no, box id =B1 and id =B3 to collapse, and when maybe is clicked, box id=B1 and id=B2 to collapse. With the code below, there is a collapse, but it does not work as intended.</p>
  
  <pre><code>library(shiny)
  library(shinyBS)
  library(dplyr)
  library(shinydashboard)
  
  
  # javascript code to collapse box
  jscode &lt;- "
  shinyjs.collapse = function(boxid) {
  $('#' + boxid).closest('.box').find('[data-widget=collapse]').click();
  }
  "
  
  #Design sidebar
  sidebar &lt;- dashboardSidebar(width = 225, collapsed=F, 
                              sidebarMenu(id="tabs",
                                          menuItem("zz", tabName = "zz", selected=TRUE)))
  
  #Design body 
  body &lt;- dashboardBody(shinyjs:::useShinyjs(), 
                        shinyjs:::extendShinyjs(text = jscode),
                        tabItems(
                          tabItem(tabName = "zz", 
                                  fluidRow(box(radioButtons('go','Go', choices = c("yes", "no", "maybe"))),
                                           box(id="B1", collapsible=T,  status = "primary", color="blue", solidHeader = T, 
                                               title="Test"),
                                           box(id="B2", collapsible=T,  status = "primary", color="blue", solidHeader = T, 
                                               title="Test2"),
                                           box(id="B3", collapsible=T,  status = "primary", color="blue", solidHeader = T, 
                                               title="Test3")
  
                                           ))
                          ))
  
  Header &lt;- dashboardHeader()
  
  #Show title and the page (includes sidebar and body)
  ui &lt;- dashboardPage(Header, sidebar, body)
  
  
  server &lt;- shinyServer(function(input, output, session){
  
    observeEvent(input$go == "yes",
  
                 {js$collapse("B2", "B3")}
  
    )
    #
    observeEvent(input$go == "no",
  
                 {js$collapse("B1", "B3")}
    )
  
    observeEvent(input$go == "maybe",
  
                 {js$collapse("B1", "B2")}
    )
  
  })
  
  shinyApp( ui = ui, server = server)
  </code></pre>