Javascript Reference
Categories: SELECT

javascript SELECT length

@March 15, 2008, 1:22 a.m.
lengthFirefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 1  

Read/Write  

The number of option objects nested inside the select object. The value returned is the same as the select object options.length property, and can be safely used as a for loop maximum counter value to iterate through the nested option objects. The W3C DOM specifies that this property is read-only, but because the property has been read/write for some time in mainstream browsers, you can continue to adjust this value. By and large, the only modification made to this property, if at all, should be setting its value to zero to empty all options from the select object. Better still, if you are authoring for IE 5 and later or Netscape 6, use the select.remove( ) and select.add( ) methods to modify the contingent of option elements nested inside the select element.

 
Example
 
document.forms[0].mySelect.length = 0;
 
Value

Integer.

 
Default

None.

Dear gakaa.com webmaster, Your posts are always a great source of knowledge.
Mitzi Follett - 3 days
https://fcialisj.com/ - cialis buy online usa
havoity - 4 years

Powered by Linode.