title: Is this a bug with Internet Explorer 8's onpropertychange event?
body: <p>I'm using the onpropertychange event to detect changes to a textbox while the user is typing (i.e. before the box looses focus). This is working, however there appears to be a bug which occurs when I set the textbox value using using code. Doing so causes the onpropertychange event to fire, as it should, however the <em>next</em> change that the user makes to the textbox will not cause the event to fire. The change <em>after</em> the next change does fire the event however, and it continues to work normally until the textbox value is set using code again.</p>
  
  <p>Steps to reproduce:</p>
  
  <p>1) Add onpropertychange event as either an attribute of the textbox HTML element, or using the DOM. (document.form.TextboxName.onpropertychange = myHandler)
  2) Observe that onpropertychange events are firing when textbox changes
  3) Set textbox value using code (document.form.TextboxName.value = "New value")
  4) Observe that this causes the event to fire
  5) Change the textbox value using the keyboard (insert a latter, backspace or delete, etc)
  6) Observe that no event is fired this time
  7) Change the textbox value using the keyboard again. Events continue to fire as normal</p>
  
  <p>First of all I'd like to get confirmation that this is indeed an IE bug, and that my code isn't to blame. I'm also looking for advise on how to work around this issue. I want to track all changes to the textbox value as they are made. The other events such as onkeydown are all limited in that they don't detect non-keyboard methods of modifying the value. This only needs to work in IE 8.</p>
  
  <p><strong>Edit:</strong> Code below. Running on my browser at home (IE9), the stated issue does not occur. However IE9 exhibits a bug where backspaces do not fire the onpropertychange event at all! Switching modes to IE8 standards (press F12 and choose browser mode) causes the code to run as stated in this post (events fire until the control's text value is set using code, in which case the next character entered will not fire the event.)</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" language="javascript"&gt;
  
  var changingValue = false;
  
  function onpropchange(){
      if (window.event.propertyName == "value" &amp;&amp; !changingValue) {
          // Do stuff here
          alert("Changed via user input");
      }
  }
  
  function setTextBoxValue(val) {
      var textBox = document.getElementById("foo");
      changingValue = true;
      textBox.value = val;
      changingValue = false;
  }
  
  window.changeValue = function() {
      setTextBoxValue("NEW VALUE");
  }
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;input id="foo" onpropertychange="onpropchange();"&gt;
  &lt;input type="button" value="change value" onclick="changeValue()"&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>