Javascript Reference
Categories: SELECT

javascript SELECT type

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

Read-only  

Returns the type of form control element. A select object has two possible values, depending on whether the element is set to be a multiple-choice list. The value is returned in all lowercase letters. It may be necessary to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text" while leaving other controls untouched).

 

Note that Navigator 4 incorrectly reports a select object's type as select-multiple if the element's size attribute is set to any value larger than 1, even if the multiple attribute is not set. This is fixed in Netscape 6.

 
Example
 
if (document.forms[0].elements[3].type == "select-multiple") {
    ...
}
 
Value

Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea.

 
Default

Depends on value of multiple.


Powered by Linode.