Description Usage Arguments Author(s) Examples
Programmatically click a button
1 | click(ids)
|
ids |
id(s) of button to be clicked |
richard.kunze
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
fluidRow(
numericInput("clickBtn", "Click Btn Nr:", 1, 1, 3, 1),
actionButton("btn1", "1"),
actionButton("btn2", "2"),
actionButton("btn3", "3"),
dq_space(),
textOutput("result")
)
),
server = function(input, output) {
output$result <- renderText(paste("Buttons clicked:",
toString(c(input$btn1, input$btn2, input$btn3))
))
observeEvent(input$clickBtn, click(paste0("btn", input$clickBtn)),
ignoreInit = TRUE)
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.