|
-
Sep 5th, 2001, 10:34 AM
#1
Thread Starter
Evil Genius
Js - clearing removing select options
Code:
for (intCounter=0; intCounter<formName.selectName.options.length; intCounter++)
{
formName.selectName.options.remove(intCounter);
}
I'm trying to clear / remove all the option tags from a select object / tag using Javascript.
As I can't find the equivalent to the vb clear statement, I'm tring the loop above. Has anyone trid this before & suceeded ?
Thanks,
-
Sep 5th, 2001, 10:40 AM
#2
Frenzied Member
I just set the options length to 0.
Code:
document.myForm.mySelect.options.length = 0;
I haven't had any problems with that.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Sep 5th, 2001, 10:44 AM
#3
Thread Starter
Evil Genius
That's fantastic than you , been a huge help !
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
|