javascript - reactive tooltipBS in shiny using ShinyBS -


i try use shinybs package simple app. want create reactive tooltip text depends on each radiobutton.

in order clarify problem wrote simple code in html & js.

i found 1 solution seemed solve issue, not think works properly. possible using shinybs package?

i want implement html & js code shiny still not work.

library(shiny)  yourstr <-   "$(document).ready(function(){                       $('[id='radio_venue_1']').tooltip({                                 placement: 'right',                                 title: 'button 1 explanation',                                 trigger: 'hover'                                 });                        $('[id='radio_venue_2']').tooltip({                                 placement: 'right',                                 title: 'button 2 explanation',                                 trigger: 'hover'                                 });                        $('[id='radio_venue_3']').tooltip({                                 placement: 'right',                                 title: 'button 3 explanation',                                 trigger: 'hover'                                 });                                 }); "  ui <- shinyui(    fluidpage(     fluidrow(       column(3,              html("<div class='container'><br>                   <h1>test</h1>                   <div>                   <label id='radio_venue_1'>                    <input type='radio' value='1' role='button'> button 1                    </label>                   </div>                   <div>                   <label id='radio_venue_2'>                   <input type='radio' value='2' role='button'> button 2                   </label>                   </div>                   <div>                   <label id='radio_venue_3'>                   <input type='radio' value='3' role='button'> button 3                   </label>                   </div>                   </div>")       ),        column(9,              'plot')       ),   tags$script(html(yourstr))     )   )  server <- function(input, output, session) {   }  shinyapp(ui = ui, server = server) 

you can shinybs package

rm(list = ls()) library(shiny) library(shinybs)  ui <- shinyui(   fluidpage(     fluidrow(       column(3,              html("<div class='container'><br>                   <h1>test</h1>                   <div>                   <label id='radio_venue_1'>                    <input type='radio' value='1' role='button'> button 1                    </label>                   </div>                   <div>                   <label id='radio_venue_2'>                   <input type='radio' value='2' role='button'> button 2                   </label>                   </div>                   <div>                   <label id='radio_venue_3'>                   <input type='radio' value='3' role='button'> button 3                   </label>                   </div>                   </div>")),        bstooltip(id = "radio_venue_1", title = "button 1 explanation", placement = "right", trigger = "hover"),       bstooltip(id = "radio_venue_2", title = "button 2 explanation", placement = "right", trigger = "hover"),       bstooltip(id = "radio_venue_3", title = "button 3 explanation", placement = "right", trigger = "hover"),       column(9,'plot')       )     )   )  server <- function(input, output, session) {} shinyapp(ui = ui, server = server) 

enter image description here


Comments