我如何在 shinyalert 中使用标签列表框 html?

How I can use tag-list box html in shinyalert?

我使用 shinyalert,我想在使用 HTML 时放入标签列表框,但它不起作用

shinyalert(
      type = "info",
      confirmButtonText = "close",
      confirmButtonCol = "#6DBADE",
      size = "l", 
      closeOnEsc = TRUE,
      closeOnClickOutside = TRUE,
      animation = TRUE,
      html = TRUE,
      text =  HTML("
             <form action=''>
             <input list='cars'>
             <datalist id='cars'>
             <option value='BMW' />
             <option value='Bentley' />
             </datalist>
             </form>") 
    )

知道我的问题出在哪里吗?

首先,删除 HTML.

现在,我不知道为什么,但是 css .sweet-alert input 有 属性 display: none;.

所以你可以这样做:<input list='cars' style='display: block;'/>.


编辑

但是,下拉菜单不起作用。您可以这样做:

  shinyalert(
    type = "info",
    confirmButtonText = "close",
    confirmButtonCol = "#6DBADE",
    size = "l", 
    closeOnEsc = TRUE,
    closeOnClickOutside = TRUE,
    animation = TRUE,
    html = TRUE,
    text = selectInput("slct", label = NULL, choices = c("BMW", "Honda"))
  )