title: Cannot simply force focus on text input in stand-alone Google App using HtmlService?
body: <p>I want to script a click on an input box.</p>
  
  <p>Here is an example where the focus() should do just that, but it doesn't! Why?</p>
  
  <p>Code.gs:</p>
  
  <pre><code>function doGet(e) {
  
    return HtmlService.createHtmlOutputFromFile('myFile');
  
  }  
  </code></pre>
  
  <p>myFile.html:</p>
  
  <pre><code>&lt;input type="text" id="new" onchange="adding(this)"/&gt;
  
  &lt;div id="data"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  
     document.getElementById('new').focus();
  
     function adding(a){
  
        document.getElementById('data').innerHTML += a.value;
  
        a.value = '';
     }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I have also tried without success putting the focus() in its own function and having a body element whose onload calls that function. </p>
  
  <p>What DOES work is having a button whose onclick calls that function, so focus() does eventually become active. Is there some other event I can use to trigger it?</p>
  
  <p>I am using a Chromebook. Could that be the problem? </p>