Deselect any selected items in a select form field with multiple attribute?

Discussion in 'Javascript' started by Keiron Waites, Oct 21, 2003.

  1. Hi,

    I have two select fields with the multiple attribute so you can see all
    options. When a user clicks on one form, I would like to deselect anything
    from the other form. Is there a way to do this? eg
    document.forms.form.list1.selectedIndex='NULL'; ?

    Where can I find out about all options with regards to the DOM?

    Thanks,

    Keiron
     
    Keiron Waites, Oct 21, 2003
    #1
    1. Advertisements

  2. Ok I've answered my own question:

    document.form.list1.selectedIndex='-1';

    -1 means that nothing is selected in the select field. I hope this helps
    someone.
     
    Keiron Waites, Oct 21, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.