Say I have an object in the browser DOM with class=“row”
and id=“row22”
.
I want to use Shiny.onInputChange()
to detect a click on that object and send the id to a Shiny input$
variable. I’ve worn out Google looking for an example of how to do this but haven’t come up with anything. Could someone who knows how to do this provide some sample code?
it should work something like $(document).on
in jquery
For example:
In Javascript, added a function that looks like this:
function my_row(n) {
Shiny.onInputChange("js.row", n);
};
In Shiny code added an observer that looks for changes on
input$js.row
:
observeEvent(input$js.row, {
print(paste0("Value of js.row is ", input$js.row))
})
still Shiny.OnInputChange
not triggering observeEvent(input$js.row
! Do we have alternative approach?