title: How do I populate an html text input field based on an html select option
body: <p>I'm working on an <code>html</code> page that will allow users to get pre-populated text filled into the text input field, based on the option they select.  I'm trying to do this via <code>javascript</code> but I can't get the function to &quot;fire&quot; when I do an <code>onchange</code> within the select input field.</p>
  <p>Trying to figure out what I'm doing wrong, either with the function, the innerHTML, or both.</p>
  <p>Example code I'm working on below:</p>
  <p><code>HTML</code></p>
  <pre><code>&lt;label for='accountg'&gt;Goal&lt;/label&gt;
      &lt;select id=&quot;accountg&quot; name=&quot;accountg&quot; style=&quot;border-radius:1px;border:1px solid #003399;font-size:14px;width:50px;&quot; onchange=&quot;accountSelect()&quot;&gt;
          &lt;option value=''&gt;&lt;/option&gt;      
          &lt;option value='1'&gt;&lt;/option&gt; 
          &lt;option value='2'&gt;&lt;/option&gt;
          &lt;option value='3'&gt;&lt;/option&gt;
          &lt;option value='4'&gt;&lt;/option&gt;
          &lt;option value='5'&gt;&lt;/option&gt;
      &lt;/select&gt;
  
  &lt;input type=&quot;text&quot; id=&quot;account1&quot; name=&quot;account1&quot; style=&quot;width:900px;&quot; title=&quot;140 character maximum&quot; /&gt;
  </code></pre>
  <p><code>JAVASCRIPT</code></p>
  <pre><code>function accountSelect() {
  var aSelect = document.getElementById('accountg').value;
  var account1 = '';
  
      if(aSelect == '') {
  
      } else if(aSelect == 1){
  
          if(account1 == '')
              {
                  var act1 = 'Outlines written policies and procedures to ensure consistent adherence by staff.';
                  document.getElementById('account1').innerHTML = act1;
              } else {}
      }
  }
  </code></pre>