Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Form | 4 | Q739 [ previous next ]

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.

©2018 Martin Webb