runjs

0th

Percentile

Run JavaScript code

Run arbitrary JavaScript code.

Usage
runjs(code)
Arguments
code

JavaScript code to run.

Note

shinyjs must be initialized with a call to useShinyjs() in the app's ui.

See Also

useShinyjs

Aliases
  • runjs
Examples
# NOT RUN {
if (interactive()) {
  library(shiny)
  shinyApp(
    ui = fluidPage(
      useShinyjs(),  # Set up shinyjs
      actionButton("btn", "Click me")
    ),
    server = function(input, output) {
      observeEvent(input$btn, {
        # Run JS code that simply shows a message
        runjs("var today = new Date(); alert(today);")
      })
    }
  )
}
# }
Documentation reproduced from package shinyjs, version 1.0, License: AGPL-3

Community examples

Looks like there are no examples yet.