I want to show an image in a modalDialog, but R does not render one.
The following code only shows a link to the Google logo, but not the Google logo itself:
Server.R:
observeEvent(input$button, {
showModal(modalDialog(
title = "Title",
'<img>https://www.google.nl/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png</img>',
easyClose = TRUE,
footer = NULL
))
})
UI.R
actionButton(inputId ="button", label = "Click me")
observeEvent(input$button, {
showModal(modalDialog(
title = "Title",
HTML('<img src="http://www.google.nl/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png">'),
easyClose = TRUE,
footer = NULL
))
})
There is an error in your html. Use the HTML(...)
tag to specify html code and then specify the source in the <img>
tag. The above code works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With