Alert or prompt OK not being selected when user hi

2019-08-29 07:27发布

问题:

How can I get the OK button to be clicked when I use an alert or prompt?

SpreadsheetApp.getUi().alert("something goes here");

回答1:

The alert prompt description has the exact method to do this.

I'm not going to copy and paste the sample provided, as I feel that's a bit of a waste.



回答2:

You can use "alert(prompt, buttons)" or "alert(title, prompt, buttons)"

You can also use the "Enum ButtonSet" in this documentation.

However I don't think its possible that we can change it to recognize hitting the enter key as clicking "OK" button in Apps script .

Hope that helps!