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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top