Force all select boxes on page to default?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Erich93063

    Force all select boxes on page to default?

    I have a form with about 40 select boxes that are pre selected with
    selections based on some passed data. What is a quick and easy way to
    have a link on the page where when I click on it, it forces ALL of the
    select boxes back to their default state selecting the first option in
    the list which has a value of "" and the display value is "SELECT". I
    basically want to reset them all.

    ??

    THANKS

  • Michael White

    #2
    Re: Force all select boxes on page to default?

    Erich93063 wrote:
    I have a form with about 40 select boxes that are pre selected with
    selections based on some passed data. What is a quick and easy way to
    have a link on the page where when I click on it, it forces ALL of the
    select boxes back to their default state selecting the first option in
    the list which has a value of "" and the display value is "SELECT". I
    basically want to reset them all.
    >
    s=document.getE lementsByTagNam e("select");ss= s.length;
    while(ss--)s[ss].options[0].selected=true;
    Mick

    Comment

    • Erich93063

      #3
      Re: Force all select boxes on page to default?

      On Feb 20, 11:33 am, Michael White <m...@mickweb.c omwrote:
      Erich93063 wrote:
      I have a form with about 40 select boxes that are pre selected with
      selections based on some passed data. What is a quick and easy way to
      have a link on the page where when I click on it, it forces ALL of the
      select boxes back to their default state selecting the first option in
      the list which has a value of "" and the display value is "SELECT". I
      basically want to reset them all.
      >
      s=document.getE lementsByTagNam e("select");ss= s.length;
      while(ss--)s[ss].options[0].selected=true;
      Mick
      AWESOME! Worked perfectly. Thanks!

      Comment

      Working...