If i were you i would attach the event to each of my form elements.
It will be more CPU costly but will give you more flexibility since you will
be able to set change just to some of the elements of the form.
To complete, change event is meant to be used with input forms, so it will
be really buggy if applyed to a div.
Check this: http://www.quirksmode.org/dom/events/change.html
It may help you.


Fábio Miranda Costa
Engenheiro de Computação
http://meiocodigo.com


On Mon, Feb 16, 2009 at 10:42 PM, batman42ca <[email protected]> wrote:

>
> 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