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

K

Keiron Waites

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
 
K

Keiron Waites

Keiron Waites said:
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

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top