O'Reilly logo

Web Application Development with R Using Shiny by Chris Beeley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

jQuery

For the ultimate quick and clean code, let's add some jQuery. We are going to add mouseover row highlighting (that is, coloring in the rows of a table when the mouse pointer is on them) for a table from Shiny (this can be done in CSS, of course, but this is just an example) and allow the user to bold individual cells by clicking on them, as well as producing a pop-up information box about the dataset.

index.html – body

We'll skip the head for now and look at the body of the index.html file:

<body> <h1>jQuery example</h1> <div id = "navigation"> <label for="dataSet">Select dataset</label> <select id="dataSet"> <option value="iris" selected="selected"> Iris data</option> <option value="USPersonalExpenditure"> Personal expenditure data</option> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required