Changing selectedIndex and onchange events

Discussion in 'Javascript' started by Tom Cole, Mar 20, 2007.

  1. Tom Cole

    Tom Cole Guest

    Whilst I have no immediate need for it, I've noticed that if a select
    element is changed via setting the selectedIndex value, it does not
    fire an onchange event. Is there any reason for this? Both IE 6 and FF
    2 behave the same in regards to this.

    Is it the developers responsibility to fire this event in such a
    Tom Cole, Mar 20, 2007
    1. Advertisements

  2. Tom Cole

    VK Guest

    At least for IE there is:
    "The onchange event does not fire when the selected option of the
    select object is changed programatically."

    I don't remember if it is some standard DOM interface feature or a
    "default common behavior" of all browsers. From the practical point of
    view it is not so relevant though.
    Yes, see above.
    I'm afraid so. And remember that custom events do not propagate
    (bubble) so you have to fire them for each event consumer separately.
    VK, Mar 20, 2007
    1. Advertisements

  3. Tom Cole

    RobG Guest

    The W3C event model provides dispatchEvent, IE provides fireEvent.
    The archives are a remarkable resource - Michael Winter provides a
    very comprehensive answer here:

    subject: How to trigger event programmatically?
    RobG, Mar 21, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.