Description Usage Arguments See Also Examples
associate a click on an HTML element with an input value. The name of input value is free.
1 | click_event(id, event_id = paste0(id, "_event"), event_type = "click")
|
id |
shiny input id on which click listener has been set |
event_id |
reactive input to be incremented when click if fired. |
event_type |
the type of event, can be one of: |
Other javascript functions: ability
,
activate
, html_class
,
html_toogle
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 26 27 28 29 30 31 | library(shinytools)
library(shiny)
if (interactive()) {
options(device.ask.default = FALSE)
ui <- fluidPage(
titlePanel("Hello dghiesse!"),
load_jstools(),
sidebarLayout(
sidebarPanel(
div(span(id = "aspan", "click me")),
click_event("aspan", "myclick")
),
mainPanel(
htmlOutput(outputId = "content")
)
)
)
server <- function(input, output) {
observeEvent(input$myclick, {
output$content <- renderUI({
div(paste0("aspan has been clicked ",
input$myclick, " times"))
})
})
}
print(shinyApp(ui, server))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.