【问题标题】:Is there a way to place a hyperlink inside a textInput with Shiny R有没有办法用 Shiny R 在 textInput 中放置超链接
【发布时间】:2019-10-20 00:20:12
【问题描述】:

对于我目前正在处理的项目,我想使用闪亮的 R 在 textInput 框中放置一个超链接。在 R 中使用以下脚本时,我的 html 代码将显示在 textInput 框中,而不是显示“Google 主页”作为可点击的链接。


test <- a("Google Homepage", href="https://www.google.com/")

runApp(
    list(ui = fluidPage(
         textInput("test", "test", test)
    ),
    server = function(input, output, session){
    })
)

是否可以在文本输入框中放置超链接?还是仅作为输出值?

【问题讨论】:

标签: r url shiny textinput


【解决方案1】:

正如@Stéphanie 提到的,这是不可能的。 因为您将 a 标签作为输入元素的值包含在内。如果您查看 HTML,您将看到:

<input id="test" type="text" class="form-control shiny-bound-input" value="<a href=&quot;https://www.google.com/&quot;>Google Homepage</a>">

因此,如果您只想要一个可点击的链接,则不需要textInput。 只需将a tag 放入fluidPage

test <- a("Google Homepage", href="https://www.google.com/")

runApp(
  list(ui = fluidPage(
    test
  ),
  server = function(input, output, session){
  })
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多