How to Use Javascript inside Rmd Documents
It is possible to put custom js code inside Rmarkdown documents.
Table of Contents
Embedding <script>
tag
We can just embed any html tag such as script
or style
directly inside the Rmarkdown text. They will be included in the final html output.
<script>window.alert("hello")</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script>
Embedding js
blocks
Or we can use the usual code blocks.
JQuery is already included with Rmarkdown. So, we can use JQuery functions directly:
$('.title').text("hello")