add_javascript: Add necessary JavaScript code to enable interactivity

Description Usage Arguments Value Examples

View source: R/add_javascript.R

Description

Add necessary JavaScript code to enable interactivity

Usage

1
add_javascript(in_html_doc = TRUE, filepath = NULL)

Arguments

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.

Value

Either outputs raw HTML/JavaScript code that can live inside an HTML file, or creates a '.js' file containing the JavaScript code.

Examples

 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)

bschneidr/selr documentation built on May 1, 2021, 10:05 p.m.