Hide
Apps Script

Class Button

Button

Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

A standard push-button widget.

Here is an example of how to use this widget:

 

 function doGet() {
   var app = UiApp.createApplication();
   // create a button and give it a click handler
   var button = app.createButton("click me!").setId("button");
   button.addClickHandler(app.createServerHandler("handlerFunction"));
   app.add(button);
   return app;
 }

 function handlerFunction(eventInfo) {
   var app = UiApp.getActiveApplication();
   app.getElementById("button").setText("I was clicked!");
   return app;
 }
 

Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the Button documentation here.

Deprecated methods