title: R Shiny toggle text of actionLink
body: <p>I am trying to do something which I thought would be relatively simple, but I cannot seem to figure it out.</p>
  
  <p>I am attempting to have an actionLink which, when pressed, provides additional information for the user. When pressed again it hides the information. I can do this fine, but what I am struggling with is updating the text of the actionLink.</p>
  
  <p>I want it to read "Show additional" when the extra information is hidden, and then "Hide additional" when the information is exposed. I have read the following questions/answers, but cannot quite get it to work.</p>
  
  <p><a href="https://stackoverflow.com/questions/33590653/modify-shiny-action-button-once-it-is-clicked">Modify shiny action button once it is clicked</a></p>
  
  <p><a href="https://stackoverflow.com/questions/33777991/update-label-of-actionbutton-in-shiny">Update label of actionButton in shiny</a></p>
  
  <p>I have provided a simple code for this below, though the real example will be a lot more complex.</p>
  
  <p>Thank you for your time and help.</p>
  
  <pre><code>shinyApp(
    ui = shinyUI(fluidPage(useShinyjs(),
                           actionLink("button", "Show additional"),
                           hidden(
                             div(id='text_div',
                                 verbatimTextOutput("text")
                                 )
                             )
                           )
                 ),
  
    server = function(input, output, session){
      observeEvent(input$button, {
        toggle('text_div')
        output$text &lt;- renderText({"Additional"})
      })
  
    }
  )
  </code></pre>