I am trying to integrate the autoNumeric jQuery plugin (
http://www.decorplanit.com/plugin/) into my shiny app to add currency and comma separators into a text input. I am a totally new a jQuery, and would appreciate any help. Below is a copy of my code where HTML('<script src="
http://code.jquery.com/jquery-latest.min.js" type="text/javascript"> </script>') &
HTML('<script src="autoNumeric-(with latest version).js",type=text/javascript> </script>'), are links to the plugin, and money.js is a script I have stored in the www folder in the app directory. Thanks!
ui.R
library(shiny)
shinyUI(
fluidPage(
sidebarLayout(
sidebarPanel(
HTML('<script src="autoNumeric-(with latest version).js" type=text/javascript> </script>'),
HTML('<script src="money.js" type="text/javascript"></script>'),
HTML('<div id="currency">'),
numericInput('dollarValue', "Input Dollar Value", "1000"),
HTML('</div>')
),
mainPanel(
verbatimTextOutput('dollar')
)
)
)
)
Server.R
library(shiny)
shinyServer(function(input, output) {
output$dollar <- renderPrint({
dollar <- input$dollarValue
dollar
})
})
money.js
jQuery(function($) {
$('#currency').autoNumeric('init');
});