I set a "change" event on a div. That div surrounds a form with a
single select element. When I make a new selection with the select
element, my event fires with Firefox2 but not IE6.

I'm wondering which browser is correct and what I can do about it
besides place a change event on every form field (if my form had more
fields). Should a change event attached to a div fire when something
it contains is changed (Firefox) or since a change event on a div
doesn't really made sense, should it fail to fire (IE6)

Here's the test code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
<script type="text/javascript" src="mootools/mootools-1.2.1.js"></
script>

<script type="text/javascript">
  window.addEvent("domready",function() {
    $("formFields").addEvent("change",function() {
      alert("change");
    });
  });
</script>

</head>

<body>
<div id="formFields">
  Text goes here
  <form>
    <select>
      <option value="one">one</option>
      <option value="two">two</option>
      <option value="three">three</option>
    </select>
  </form>
</div>

</body>
</html>

Reply via email to