title: Trigger onKeyUp from script after input value is changed
body: <p>I have a few input fields that use <code>onKeyUp="script"</code> to return data the moment something is entered.</p>
  
  <p>As a shortcut, I would like to be able to add a value to one of the fields when data is entered from another location AND trigger the script.</p>
  
  <p>I can use <code>document.getElementById("myID").value = MyValue;</code> to add a specific value to the input box, or <code>.addEventListener();</code> to watch another input field.
  This part works well.</p>
  
  <p>However, I have not been able to trigger anything equivalent to <code>onKeyUp</code>, which will happen either when:
  1. You press/release a key while the input field is in focus.
  2. You focus the input and release a key AFTER the script has added a value.
  3. You enter the input field via [TAB] AFTER the script has added a value.</p>
  
  <p>Adding <code>.keyup();</code> or <code>.keypress();</code> have had no effect.
  I've been able to use <code>.focus();</code> to focus and then change the input, but this does not have the same effect as pressing [TAB]</p>
  
  <p>What can I do to trigger the <code>onKeyUp</code> for this field, even if the data was not manually typed?</p>
  
  <p><strong>ADDITIONAL INFO</strong></p>
  
  <p>This part works...</p>
  
  <pre><code>&lt;input type="text" id="box1" onKeyUp="script1();"&gt;
  &lt;div id="result1" "&gt; (script places result here) &lt;/div&gt;
  </code></pre>
  
  <p>Add value from another location - Option 1</p>
  
  <pre><code>&lt;input type="text" id="Test1"&gt;
  &lt;button type="button" onclick="TestScript()"&gt; TEST&lt;/button&gt;
  
  &lt;script type='text/javascript'&gt;
    function TestScript() {
      var test1=document.getElementById("Test1").value;
      document.getElementById("box1").value = test1;
      document.getElementById("box1").keyup();
      return false;
    }
  &lt;/script&gt; 
  </code></pre>
  
  <p>Add value from another location - Option 2</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
    window.onload = function () {
      document.getElementsByName("box2")[0].addEventListener('change', TestScript2);
      function TestScript2(){
        var test2=document.getElementById("box2").value;
        document.getElementById("box1").value = test2;
    }}
  &lt;/script&gt;
  </code></pre>
  
  <p>Both of these options will copy the value to the correct location, but I have not been able to get either to trigger the <code>onKeyUp</code> so that the original script realizes something has changed.</p>
  
  <p><strong>Non working Fiddle example:</strong> <a href="https://jsfiddle.net/mj8g4xa2/4/" rel="nofollow noreferrer">https://jsfiddle.net/mj8g4xa2/4/</a></p>