title: Get value of html text box in Apps Script function
body: <p>Something is wrong here, and all the suggestions I've tried from others with similar questions don't seem to work. </p>
  
  <p>I have two files: myPage.html and myCode.gs in google scripts. I have deployed the html file as a web app, and I have figured out (with help) how to make the onclick event for the 'submit' button to trigger the emailTech function from the myCode.gs file just fine. </p>
  
  <p>Now I want to insert the value from the text box in the html file into the email that is called from the onClick event. I have tried <code>document.getElementById('textBoxId').value</code>, but I get the following error "Reference Error: "document" is not defined. " What gives?</p>
  
  <p>myPage.html file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="button" onClick="google.script.run.emailTech();" value="Submit" /&gt;
  
  &lt;input type="text" value=" " id = "textBox" name = "textBox" /&gt;
  &lt;/body&gt;
      &lt;script type="text/javascript"&gt;
      &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>myCode.gs file:</p>
  
  <pre><code>  function doGet() {
    return HtmlService.createHtmlOutputFromFile('myPage');
  }
  
  function emailTech(){
  
    var nameBox = document.getElementById('textBox').value;
    var message = "This is the text box value" + nameBox;
    MailApp.sendEmail("123@xyz.com", "This is the subject", message );
  }
  </code></pre>