SHARE
TWEET

Untitled

a guest Aug 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(shiny)
  2.  
  3. randomNumberButton <- function(inputID){
  4.     tagList(
  5.         singleton(
  6.             tags$head(tags$script(src="button.js"),
  7.                       tags$script(src="button-binding.js"))
  8.         ),
  9.         tags$div(
  10.             id = inputID,
  11.             tags$button(
  12.                 type = "button",
  13.                 class = "random-number-generator",
  14.                 "Click"
  15.             )
  16.         )
  17.     )
  18. }
  19.  
  20. ui <- fluidPage(
  21.     # random number generator
  22.     randomNumberButton("test"),
  23.     textOutput("printTest")
  24. )
  25.  
  26. server <- function(input, output, session) {
  27.     observeEvent(input$test,{
  28.         output$printTest <- renderText(input$test)
  29.     })
  30. }
  31.  
  32. shinyApp(ui, server)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top