www.webdeveloper.com
Results 1 to 4 of 4

Thread: Deselect the Value in ListBox (Urgent)

  1. #1
    Join Date
    Jan 2006
    Posts
    2

    Question Deselect the Value in ListBox (Urgent)

    Hi,

    I need an urgent help from you.

    When we dynamically genrate any list box (Select Box) it shows one default value as selected.

    Is there any way that we can deselect that value.

    I tried with document.form_Name.ListBox_Name.options[0].selected = false;

    I don't want any value to be selected in the list Box.

    Its quite urgent.

    Please help.

    Thanks,
    Deepa

  2. #2
    Join Date
    Dec 2005
    Location
    FL, USA
    Posts
    265
    The select box must show a "first value". If you want nothing, write

    Code:
    <select>
       <option></option>
       <option value="something">Something else</option>
    </select>

  3. #3
    Join Date
    Aug 2005
    Posts
    66
    Or as most web sites put...

    "Please Select an option" as the first element, then test for it in validation.
    53 6D 61 72 74 41 73 73

  4. #4
    Join Date
    Jan 2006
    Posts
    2

    Red face

    I got the reply...

    This is the solution...

    document.form_Name.ListBox_Name.selectedIndex = -1;


    Thanks,
    Deepa

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles