Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q739 How can I remove all the entries from a select form field?

irt.org | Knowledge Base | JavaScript | Form 4 | Q739 [ previous next ]

Q739 How can I remove all the entries from a select form field?

Chopping an array's length property (i.e., setting it to something less than it is currently) clears the items from the end of the select object. So:

document.form.select.options.length = 0

which clears a list in one instruction.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.