2

For a project I'm currently working on, I want to place a hyperlink inside a textInput box using shiny R. When using the following script in R my html code gets shown inside the textInput box instead of showing "Google homepage" as a clickable link.


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

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

Would it be possible to place a hyperlink inside a textInput box? Or only as a output value?

1 Answers1

1

As @Stéphanie mentioned, this is not possible. Because you include the a tag as value of an input element. If you look at the HTML you will see:

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

So if you just want a clickable link you dont need a textInput. Just put the a tag in the fluidPage:

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

runApp(
  list(ui = fluidPage(
    test
  ),
  server = function(input, output, session){
  })
)
SeGa
  • 9,454
  • 3
  • 31
  • 70