SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Offspring2099's Avatar
    Join Date
    May 2005
    Location
    Los Angeles, CA
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question w3c dom question (onchange).

    I need to go through all INPUT tags and append another js function to be called.

    Code:
    var x = document.getElementsByTagName('input');
    for (var i=0;i<x.length;i++) {
        x[i].onchange = function() {
            //new stuff to do					
        }
    }
    The code above overwrites the old onchange functions, but I need to add.


    Any ideas?
    Thank you.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use addEventListener (FF) / attachEvent (IE) to do that, check out
    http://cross-browser.com/x/lib/view....dEventListener for a nice cross browser fn that does it

  3. #3
    SitePoint Zealot Offspring2099's Avatar
    Join Date
    May 2005
    Location
    Los Angeles, CA
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YES! Thank you.


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
  •