title: How to detect the change on input when it changed dynamically
body: <p>How to detect the changes in input values when it is dynamically changed.
  as the change on txt2 clear the value in txt1 . I need to detect that it has cleared or changed.</p>
  
  <p>Onchange does not do that. </p>
  
  <pre><code>&lt;input id="txt1" type="text" onchange="SetDefault();" onpaste="this.onchange();" oninput="this.onchange();"&gt;
  &lt;br&gt;
  
  
  
  &lt;input id="txt2" type="text" onchange="SetDefaultSecond();" onkeyup="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"&gt;
  
  &lt;script&gt;
  function SetDefault(){
        alert("Change1");
      }
  
  function SetDefaultSecond(){
        $("#txt1").val('');
         alert("Change2");
  }
  &lt;/script&gt;
  </code></pre>