SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    looking for something like onChangeOptions

    basically I have a list that is being dynamically added to via JavaScript.

    just like a bill of materials, I need to re-assess the total after each element has been added to the select box.

    I tried "onChange" but that is too generic, and is run by every change

    I thought about a simple state machine too, where I see if the number of options is different than it last was, but I don't know how to go about implementing something like that in JavaScript.

    Anybody have any ideas?

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Third Stone From The Sun
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE - onpropertychange
    DOM - you could try DOMNodeInserted and DOMNodeRemoved

    DOMSubtreeModified is not working yet. There will be a patch soon.
    https://bugzilla.mozilla.org/show_bug.cgi?id=288392

    you could also use watch( select.options.length );

    Watch is not as powerful because it's not an actual event.
    http://developer.mozilla.org/en/docs...s:Object:watch

    You could google for options in Opera and Safari, but I wouldn't get my hopes up for those.
    My outdated site is down for a while now.

  3. #3
    Beer Monster -Ox's Avatar
    Join Date
    Apr 2003
    Location
    sowth afreeka
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternativly you might be able to create a nice little ajax script that triggers every few seconds to check weather there has been a change, and if there is, update it, else leave it as is...
    My postings are a natural product.
    The slight variations in spelling and grammar enhance its
    individual character and beauty and in no way are to be
    considered flaws or defects - http://www.guinnesspig.net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •