Closed ColinFay closed 5 years ago
library(shiny)
ui <- function(request){
tagList(
HTML(
'<label class="switch">
<input id = "plop" type="checkbox">
<span class="slider"></span>
</label>'
),
tags$script(
"$('#plop').change(function(){
var x = document.getElementById('plop').checked;
Shiny.setInputValue('pouet', x)
})"
)
)
}
server <- function(input, output, session){
observe({
print(input$pouet)
})
}
shinyApp(ui, server)
https://github.com/ThinkR-open/building-shiny-apps-workflow/blob/master/javascript.Rmd#L7
How to build Shiny JS Handler and how to create them with
{golem}
.