To opt into a more recent version of jQuery, you can add an htmlDependency
object pointing to your desired version, somewhere (anywhere) in your UI:
htmltools::htmlDependency("jquery", "3.3.1",
src = c(href = "https://code.jquery.com/"),
script = "jquery-3.3.1.min.js")
This example will serve jQuery 3.3.1 from the jQuery CDN. If your app needs to work with clients that won't be able to connect to the wider internet, you'll need to download the jquery-3.3.1.min.js file, put it in an app subdirectory (say, jquery
), and point to the directory using the src
argument.
htmltools::htmlDependency("jquery", "3.3.1",
src = here::here("jquery"),
script = "jquery-3.3.1.min.js")
Note that Shiny is only tested with the version of jQuery that it ships with, and we cannot guarantee that problems will not arise by upgrading, especially to a different major version. However, please do report any issues you run into with newer jQuery versions at https://github.com/rstudio/shiny/issues and we will try to address them.