How to capture shinyalert input field as variable

Viewed 1905

I'm trying to use the relatively new shinyAlert package to see if it offers better results than the sweetalert package but I'm unable to figure out how to get this:

Myvar <-  shinyalert input text 

from this minimal example.

library(shiny)
library(shinyjs)
library(shinyalert)

ui <- fluidPage(
  shinyjs::useShinyjs(),
  useShinyalert(),
     actionButton("run", "Run", class = "btn-success")
)
server <- function(input, output, session) {
  shinyEnv <- environment()

  observeEvent(input$run, {

    shinyalert('hello', type='input')
  })
}
shinyApp(ui = ui, server = server)

My thanks for any help from you geniouses out there.

2 Answers
Related