| useShinyjs {shinyjs} | R Documentation |
This function must be called from a Shiny app's UI in order for all other
shinyjs functions to work.
You can call useShinyjs() from anywhere inside the UI.
useShinyjs(rmd = FALSE, debug = FALSE, html = FALSE, showLog = FALSE)
rmd |
Set this to |
debug |
Set this to |
html |
Set this to |
showLog |
Set this to |
Scripts that shinyjs requires that are automatically inserted
to the app's <head> tag.
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
useShinyjs(), # Set up shinyjs
actionButton("btn", "Click me"),
textInput("element", "Watch what happens to me")
),
server = function(input, output) {
observeEvent(input$btn, {
# Run a simply shinyjs function
toggle("element")
})
}
)
}