R 从服务器端更改selectinput的边框颜色
这是一个接一个的问题。在上一个问题中,selectInput的边框是使用以下参数标记$headtags$styleHTML Select1~.selectize-control.single.selectize输入{border:1px solid dd4b39;}从ui端更改的。现在我想更改服务器端特定select输出的边框颜色。我的主要目的实际上是根据不同的条件改变颜色。为了从服务器端更改颜色,我尝试了以下代码,但似乎不起作用。有没有办法做到这一点 以下是我尝试的代码:R 从服务器端更改selectinput的边框颜色,r,shiny,shinydashboard,R,Shiny,Shinydashboard,这是一个接一个的问题。在上一个问题中,selectInput的边框是使用以下参数标记$headtags$styleHTML Select1~.selectize-control.single.selectize输入{border:1px solid dd4b39;}从ui端更改的。现在我想更改服务器端特定select输出的边框颜色。我的主要目的实际上是根据不同的条件改变颜色。为了从服务器端更改颜色,我尝试了以下代码,但似乎不起作用。有没有办法做到这一点 以下是我尝试的代码: library(sh
library(shiny)
ui <- fluidPage(
tags$head(tags$style(htmlOutput("Border_Arg"))),
selectInput("Select1", "Option1", choices = NULL),
selectInput("Select2", "Option2", choices = NULL)
)
server <- function(input, output){
output$Border_Arg <- renderUI({"#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}"})
}
shinyApp(ui = ui, server = server)
你很接近
在下面找到一个运行示例:
library(shiny)
ui <- fluidPage(
selectInput("Select1", "Option1", choices = NULL),
selectInput("Select2", "Option2", choices = NULL),
uiOutput("Border_Arg")
)
server <- function(input, output){
output$Border_Arg <- renderUI({
tags$head(tags$style(HTML( "#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}")))
})
}
shinyApp(ui = ui, server = server)
非常感谢。这正是我想要的。