title: Capture label of actionButton in Shiny app
body: <p>What's the best way to get the label of an <strong>actionButton</strong> that is clicked? I have an <strong>actionButton</strong> that has the label updated. When the user clicks, I need to capture that. I tried  input$action2.label and input$action2.text, but neither worked.</p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>library(shiny)
  
  shinyUI( fluidPage(
  
  tags$head(tags$style(
    HTML('
         { background-color: #dec4de;}
         #action4 { width: 275 px; color:red; background-color:yellow }
         #action1, #action2, #action3 { color:black; background-color:lime }
         body, label, input, button, select { font-family: "Arial"; }'
    )
  )),    
  
  titlePanel("My Shiny App!"),
  
  sidebarLayout(
    sidebarPanel(
      tabsetPanel(type = "tabs", 
                  tabPanel("About", "Developer Info here"), 
                  tabPanel("How to Use", "User Docs"))
  
    ),
  
    mainPanel(
      img(src="capstone1.jpg", align = "center"),
      br(),br(),
      tags$textarea(id="stext", rows=3, cols=80, "Default value"),
      br(),br(),br(),
      actionButton("action1", "Action 1"),
      actionButton("action2", "Action 2"),
      actionButton("action3", "Action 3"),
      br(), br(),
      actionButton("action4", 
                     label = "High &lt; &lt; &lt; &lt;  PROBABILITY  &gt; &gt; &gt; &gt; Low")
    )
  )))
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>library(shiny)
  
  shinyServer( function(input, output, session) {
  
     observeEvent(input$action1, {
        x &lt;- input$stext
        print(input$action2.text)
        updateTextInput(session, "stext", value=paste(x, "Btn 1"))
     })
  
     observeEvent(input$action2, {
        x &lt;- input$stext
        print(input$action2.label)
        updateTextInput(session, "stext", value=paste(x, "Btn 2"))
     })  
  
     observeEvent(input$action3, {
        x &lt;- input$stext
        print(x)
        updateTextInput(session, "stext", value=paste(x, "Btn 3"))
     })  
  
  })
  </code></pre>
  
  <p>UPDATE: Adding code for shinyBS</p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>{
     library(shinyBS)
     ....
     bsButton("myBtn", "")
     ...
  
  }
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>{
       ....
       updateButton(session, "myBtn", "New Label")
       ....
  }
  </code></pre>