Reputation: 674
I would like to trigger an event when the user leaves a selectize-Input. However for selectizeInput it does not work and for textInput it only fires once:
library(shiny)
ui <- fluidPage(
selectizeInput("si", label="letters", choices = letters),
tags$script(HTML(
'
$("#si").on("blur", function() {
console.log("boawigjawegaosdgi");
})
'
)),
textInput("ti", label = "ti"),
tags$script(HTML(
'
$("#ti").on("blur", function() {
console.log("boawisdgi");
})
'
)),
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
What could I change so it works?
Upvotes: 0
Views: 58
Reputation: 84649
It works normally for the textInput
For the selectizeInput
, you have to use the onBlur
option:
selectizeInput(
"si", label="letters", choices = letters,
options = list(
onBlur = I('function() {console.log("boawigjawegaosdgi")}')
)
)
Upvotes: 1