How to limit the number of characters accepted by textInput in Shiny app

后端 未结 2 954
温柔的废话
温柔的废话 2021-01-02 10:35

I would like my Shiny app (in R) to limit the number of characters a user can input in response to a textInput command.

I can request the user to limit to 50 chara

2条回答
  •  情话喂你
    2021-01-02 11:32

    You can't add custom attribute to textInput, you could probably be able to write custom function to generate input, but it will be easier to do this in javascript:

    shinyjs::runjs("$('#inputName').attr('maxlength', 50)")
    

提交回复
热议问题