## In ui.R
## Create an alert anchor:
bsAlert(inputId="aa")
## In server.R
## Add an alert to the previously created alert anchor:
createAlert(inputId = "aa", alertId="a1",
title = "Oops!",
message="Something isn't right, please recheck your inputs.",
type = "danger")
## Close the alert programatically
closeAlert(session, alertId = "a1")
Run the code above in your browser using DataLab