Using enter key with action button in R Shiny

前端 未结 4 1784
挽巷
挽巷 2020-12-08 14:41

I am trying to write a javascript function to extend the R shiny action button demo. I would like the user to be able to enter a number by both clicking the action button an

4条回答
  •  我在风中等你
    2020-12-08 15:13

    I was able to figure this out using the jQuery is(":focus") function, the code I used was:

    $(document).keyup(function(event) {
        if ($("#number").is(":focus") && (event.key == "Enter")) {
            $("#goButton").click();
        }
    });
    

提交回复
热议问题