SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2002
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    remove an OPTION from a dropdown?

    how would i go about removing options that are in a dropdown list via javascript? i assume that once i do that, i can just loop through all the options and delete them all.

    anyone know how?

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for(i = frm.sel.length - 1; i >= 0; i--)
    {
    frm.sel.options[i] = null;
    }

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2002
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    neato. thanks much

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you want to delete all of the options at once, you can do it with this one line...

    form.selectmenu.options.length = 0;
    travis


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
  •