|
-
March 4th, 2003, 04:18 AM
#1
Clear a select control List
I have 3 radio buttons and 1 select control.
The select control is populated depending on which radio button is checked.
When a radio button is clicked, I call a function that will clear the select control and polutate it again with a new list of elements.
However, I am not able to clear all the elements properly.
Is there any way I can clear all the elements in a select control at one go???
Thanks
-
March 4th, 2003, 06:46 AM
#2
The fastest way to clear the list is to set the innerHTML of the Select to ''. This will wipe out all options within.
Ex.
Code:
<select name=bob>
<option value=1>t1
<option value=2>t2
<option value=3>t3
<option value=4>t4
</select>
<input type=button name=X value=Clear OnClick="javascript:bob.innerHTML = ''">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|