im trying to invoke js across different tabs in shiny like the code below
library(shiny)
library(shinyjs)
ui <- tagList(
useShinyjs(),
navbarPage(
"shinyjs with navbarPage",
tabPanel("tab1",
actionLink(inputId = 'link',label = 'Fast Forward')
),
tabPanel("tab2",
actionButton("button", "Click me"),
textInput(inputId = "hello", label='',value = "Hello!")
)
)
)
server <- function(input, output, session) {
observeEvent(input$link, {
runjs('$("#link").click();')
})
observeEvent(input$button,{
toggle("hello")
})
}
shinyApp(ui, server)
the command is not going through, what could be the problem?