title: Javascript: Receive data from input field
body: <p>How can I receive data from input field using JavaScript in Google Scripts App?</p>
  
  <p>Ex: I have an input field on html page with some text typed in, and when I press a button that data should be send to a variable from .gs file for further use.</p>
  
  <p>This is my code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;base target="_top"&gt;
      &lt;link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css"&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1 class="center"&gt;
        &lt;b&gt;App Title&lt;/b&gt;
      &lt;/h1&gt;
      &lt;div class="form-auth"&gt;
        &lt;label class="inline"&gt;Authorization&lt;/label&gt;
        &lt;input class="auth-input" placeholder="Insert Authorization"/&gt;
      &lt;/div&gt;
      &lt;button class="btn-default start"&gt;Start&lt;/button&gt;
  
      &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $('.start').click(function() {
            alert($('.auth-input').val());
          });
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>GS:</p>
  
  <pre><code>function onOpen() {
    SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
        .createMenu('Menu')
        .addItem('Show sidebar', 'showSidebar')
        .addToUi();
  }
  
  function showSidebar() {
    var html = HtmlService.createHtmlOutputFromFile('login')
        .setSandboxMode(HtmlService.SandboxMode.IFRAME)
        .setTitle('SDR Tag Governance')
        .setWidth(300);
    SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
        .showSidebar(html);
  }
  
  function getValue() {
    //add the value from input field to a variable
  }
  </code></pre>