paulm Posted August 29, 2015 Share Posted August 29, 2015 I have a timer trigger function... function createTimeDrivenTriggers() { // Trigger every 1 hour. ScriptApp.newTrigger('createDoc') .timeBased() .everyHours(1) .create();} that calls createDoc function, which inserts JSON to paragraph: parasub = body.insertParagraph(3, "Subscribers: " + viewsb); paraview = body.insertParagraph(4, "Total Views: " + views); So every hour I'm getting 2 new paragraphs/lines added to the doc. Instead, I need to have the previous paragraphs cleared, so that only the latest JSON data shows. I'm trying to use clear() function, but if I put it above parasub/paraview, clear() is undefined, and if I put it below parasub/paraview, the data is deleted. That all makes sense. So how to clear previous parasub/paraview content before inserting new data? parasub.clear(); paraview.clear(); Link to comment Share on other sites More sharing options...
justsomeguy Posted August 31, 2015 Share Posted August 31, 2015 I'm not sure what library you're using, but a common way is to set the innerHTML property to an empty string. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now