I use textarea (HTML) in my Shiny app.
When I put a R variable inside im geeting an extra space for example:
HTML("<textarea id='aa' dir='ltr' style='font-size: 15px; name='aa' rows='12' cols='80'>hey</textarea><br><br>") #working well
x = "hey"
HTML("<textarea id='aa' dir='ltr' style='font-size: 15px; name='aa' rows='12'
cols='80'>",x,"</textarea><br><br>") #not working well - i'm getting " hey"
any idea?
CodePudding user response:
One option would we to wrap in paste0
:
library(shiny)
x <- "hey"
ui <- fluidPage(
HTML(
paste0("<textarea id='aa' dir='ltr' style='font-size: 15px; name='aa' rows='12' cols='80'>", x, "</textarea><br><br>")
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
#>
#> Listening on http://127.0.0.1:3509