Description Usage Arguments Value Examples
View source: R/add_javascript.R
Add necessary JavaScript code to enable interactivity
1 | add_javascript(in_html_doc = TRUE, filepath = NULL)
|
in_html_doc |
A single value, TRUE or FALSE, indicating whether the JavaScript should be included in the HTML document or if instead a separate '.js' file should be created. |
filepath |
If ‘in_html_doc = FALSE', the filepath of the ’.js' JavaScript file to be created. |
Either outputs raw HTML/JavaScript code that can live inside an HTML file, or creates a '.js' file containing the JavaScript code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
# RMarkdown code
```{r add_js, results='asis'}
library(selr)
add_javascript()
```
```{r add_selector, results='asis'}
add_selector(
sel_id = "Language",
options = list("Option_1" = "English",
"Option_2" = "Hebrew",
"Option_3" = "Pirate")
)
```
```{r, results='asis'}
sel_text(
sel_id = "Language",
options = list("Option_1" = "Hello",
"Option_2" = "Shalom",
"Option_3" = "Ahoy")
)
```
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.