Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

350
Views
Appscript run function onClick button from html template

I'm tryng to run this function when button click from my html template.

    function sendTeacher(){
  Classroom.Invitations.create({
    "courseId": "ID",
    "userId": "E-mail",
    "role": "TEACHER"
      });

}`

I have tryed, onClick="", and others ways but seems i'm declaring the function API wrong. Could some one help me? i'm stuck on this.

<input type="button" onClick="sendTeacher()" value="Submit" /><br>`

Tryed to:

<script>
function clickBtn(){
var classEmails = document.getElementById("txt_Email").value;
var classID = document.getElementById("class").value;
document.getElementById("classEmail").innerHTML = classEmails + ": E-mail a ser inserido";
return Classroom.Invitations.create({
"courseId": classID,
"userId": classEmails,
"role": "TEACHER"
  });

};

Html file:

    <!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <?!= include('sideBarInsertStyle') ?>
    <?!= include('sideBarInsertSelect') ?>
  </head>
    <body>

        <input type="button" onClick="sendTeacher()" value="Submit" /><br>

  </body>
</html>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try to use "onclick" instead of "onClick"

according to w3shcool https://www.w3schools.com/jsref/event_onclick.asp it using lowercase not camel case

if the script are sparated file i suggest to use addeventlistener instead

about 4 years ago · Juan Pablo Isaza Report

0

Try it this way:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <?!= include('sideBarInsertStyle') ?>
    <?!= include('sideBarInsertSelect') ?>
  </head>
    <body>
        <input type="button" onclick="google.script.run.sendTeacher();" value="Submit" />
  </body>
</html>

Either onclick or onClick will work

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!