Updating shiny input (visually) using JavaScript

In the code below I have a simple app with one slider. By runningShiny.setInputValue('debug', 1) in the browser console, we see that our input value is updated in the R console. However, the slider is not updated visually, is there a function to communicate the new input value back to JS so that the slider value updates?


ui <- function(request) {
        sliderInput("debug", "debug", value = 2, min = -2, max = 2, step = 0.01)

server <- function(input, output, session) {
    # run in browser: Shiny.setInputValue('debug', 1)
    # we see this value changes in the R console
    # but the slider itself doesn't visually change/update


shinyApp(ui, server)

Perhaps you can look at how updateSliderInput works

Ooh looking at that source code was valuable I now see on the R side I can definitely use session$sendInputMessage("debug", list(value=1)) but I am still curious how you'd go about moving the slider on the JS side/what this function does on the JS side ... I'll keep digging :slight_smile: thank you!

Take a look at the example from this documentation: Shiny - Using sliders

You can have a table or something to reflect what value the slider is on. Then when you change the slider, the value in the table will update.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.