FlamingPickle
FlamingPickle

Reputation: 189

Manipulate HTML from server-side scripts

I am trying to manipulate the HTML of an Add-On for Google Docs from server-side Google Apps Script, but have not found a method that supports it. I would like to add elements when a button is clicked.

Is this possible, or can the HTML only be changed by client-side JavaScript or jQuery?

Upvotes: 1

Views: 202

Answers (1)

JSDBroughton
JSDBroughton

Reputation: 4034

All client-side manipulations and interactions have to be done with client-side JavaScript. You can have that code interact with the apps script backend but the actual manipulation needs to be driven within the sandbox.

The button click could simply send a call to GAS which returns either data or fully formed html (recommend the former) interpreting that and adding it to the page is then handled in a success handler callback. google.run methods

Beware overuse of jQuery, a great deal of what it brings to the party can be done with vanilla js I modern browsers.

Upvotes: 1

Related Questions