title: Javascript implement event onkeypress from another onkeypress event
body: <p>I have 3 input elements. i want to use <strong>onkeyup</strong> event to get the value from the first input and copy it to the third input. But I still get an empty value in the third input when i typed in the first one. The function changethree() does not automatically get value from input second when user typed in input first. Please help me</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;input type="text" id="satu" onkeyup="changetwo(this)" placeholder="input 1"&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;input type="text" id="dua" onkeyup="changethree(this)" placeholder="input 2"&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;input type="text" id="tiga" placeholder="input 3"&gt;
  
  &lt;script&gt;
   function changetwo(a){
    var target = document.getElementById('dua');
    
    target.value = a.value;
   }
   function changethree(a){
    var target = document.getElementById('tiga');
    
    target.value = a.value;
   }
  &lt;/script&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>