Description Usage Arguments Note See Also Examples
The click()
function can be used to programatically simulate a click
on a Shiny actionButton()
.
1 |
id |
The id of the button |
asis |
If |
shinyjs
must be initialized with a call to useShinyjs()
in the app's ui.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
useShinyjs(), # Set up shinyjs
"Count:", textOutput("number", inline = TRUE), br(),
actionButton("btn", "Click me"), br(),
"The button will be pressed automatically every 3 seconds"
),
server = function(input, output) {
output$number <- renderText({
input$btn
})
observe({
click("btn")
invalidateLater(3000)
})
}
)
}
|
Attaching package: 'shinyjs'
The following objects are masked from 'package:methods':
removeClass, show
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.