{"action":"created","issue":{"url":"https://api.github.com/repos/daattali/shinyjs/issues/22","labels_url":"https://api.github.com/repos/daattali/shinyjs/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/daattali/shinyjs/issues/22/comments","events_url":"https://api.github.com/repos/daattali/shinyjs/issues/22/events","html_url":"https://github.com/daattali/shinyjs/issues/22","id":95610337,"number":22,"title":"Embedding shinyjs in markdown document without explicit ui, server pair","user":{"login":"rozsasarpi","id":6670894,"avatar_url":"https://avatars.githubusercontent.com/u/6670894?v=3","gravatar_id":"","url":"https://api.github.com/users/rozsasarpi","html_url":"https://github.com/rozsasarpi","followers_url":"https://api.github.com/users/rozsasarpi/followers","following_url":"https://api.github.com/users/rozsasarpi/following{/other_user}","gists_url":"https://api.github.com/users/rozsasarpi/gists{/gist_id}","starred_url":"https://api.github.com/users/rozsasarpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozsasarpi/subscriptions","organizations_url":"https://api.github.com/users/rozsasarpi/orgs","repos_url":"https://api.github.com/users/rozsasarpi/repos","events_url":"https://api.github.com/users/rozsasarpi/events{/privacy}","received_events_url":"https://api.github.com/users/rozsasarpi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-17T08:14:34Z","updated_at":"2015-07-27T18:31:36Z","closed_at":null,"body":"Is it possible to use `shinyjs` functions when the ui and server pair is not explicitly defined (see example __2__)?\r\n\r\nI would like to use a shiny app embedded in a markdown document, and it is convenient not to define explicitly the server and ui, e.g. markdown text can be put between code chunks of input and output elements. This approach is working with `shiny` functions but not with `shinyjs`. Please see the two examples below. Is there any way to use `shinyjs` for cases given in example __2__, or maybe this approach show be avoided if possible?\r\n\r\n__1: with explicit definition of ui and server__\r\n```\r\n---\r\ntitle: \"with ui and server\"\r\nruntime: shiny\r\n---\r\n\r\nPress the button.\r\n\r\n```{r, echo = F}\r\nlibrary(shiny)\r\nlibrary(shinyjs)\r\n\r\nshinyApp(\r\n  ui = fluidPage(\r\n    shinyjs::useShinyjs(),\r\n    actionButton(\"submit\", \"Click me!\"),\r\n    shinyjs::hidden(\r\n      span(id = \"submitMsg\", \"Message!\", style = \"margin-left: 15px;\")\r\n    )\r\n  ),\r\n  \r\n  server = function(input, output, session) {\r\n    observeEvent(input$submit, {\r\n      shinyjs::toggle(\"submitMsg\")\r\n    })\r\n  }\r\n)\r\n#``` #not commented but github thinks this is the end of the first block\r\n```\r\n\r\n__2: without explicit definition of ui and server__\r\n```\r\n---\r\ntitle: \"without ui and server\"\r\nruntime: shiny\r\n---\r\n\r\nPress the button.\r\n\r\n```{r, echo = F}\r\nlibrary(shiny)\r\nlibrary(shinyjs)\r\n\r\nfluidPage(\r\n  shinyjs::useShinyjs(),\r\n  actionButton(\"submit\", \"Click me!\"),\r\n  shinyjs::hidden(\r\n    span(id = \"submitMsg\", \"Message!\", style = \"margin-left: 15px;\")\r\n  )\r\n)\r\n\r\nobserveEvent(input$submit, {\r\n  shinyjs::toggle(\"submitMsg\")\r\n})\r\n#``` #not commented but github thinks this is the end of the first block\r\n```"},"comment":{"url":"https://api.github.com/repos/daattali/shinyjs/issues/comments/125298374","html_url":"https://github.com/daattali/shinyjs/issues/22#issuecomment-125298374","issue_url":"https://api.github.com/repos/daattali/shinyjs/issues/22","id":125298374,"user":{"login":"daattali","id":952340,"avatar_url":"https://avatars.githubusercontent.com/u/952340?v=3","gravatar_id":"","url":"https://api.github.com/users/daattali","html_url":"https://github.com/daattali","followers_url":"https://api.github.com/users/daattali/followers","following_url":"https://api.github.com/users/daattali/following{/other_user}","gists_url":"https://api.github.com/users/daattali/gists{/gist_id}","starred_url":"https://api.github.com/users/daattali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daattali/subscriptions","organizations_url":"https://api.github.com/users/daattali/orgs","repos_url":"https://api.github.com/users/daattali/repos","events_url":"https://api.github.com/users/daattali/events{/privacy}","received_events_url":"https://api.github.com/users/daattali/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T18:31:36Z","updated_at":"2015-07-27T18:31:36Z","body":"Adding some info here so that I can add rmarkdown support in the future: Joe Cheng told me how to add resources in an rmd doc, but I'm still unsure of how to efficiently use a function that adds resources to both a shiny app and an interactive doc\r\n\r\nhttps://groups.google.com/forum/#!topic/shiny-discuss/0aO5Jc6CP1Y"}}