在鼠标单击事件中删除 shiny::textInput 字段中的文本

Remove the text in a shiny::textInput field on mouse click event

我有一个简单的文本输入:

textInput(inputId = "input1", h4("Name"), value = "Your name")

如何设置onclick 事件,以便在用户单击文本字段时文本完全消失?这可以通过 shinyjs::onclick 实现吗?

您可以在 textInput

中使用 placeholder 选项
textInput(inputId =  "input1", label = h4("Name"), placeholder = "Please provide your name...")