How to Use the select label multiple Attribute
A few days ago, the company made a functional module and paid some twists and turns to it for a small feature. Now we will summarize it:
I. Implementation results:
I. Implementation Code:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
【Download resources at 0 Points]
Set multiple default values for the select tag multiple Attribute
<Select id = "" multiple = "multiple" size = "5" name = "">
<Option value = "1" selected> a </option>
<Option value = "2" selected> B </option>
<Option value = "3"> c </option>
<Option value = "4"> d </option>
</Select>
Add selected.
How does javascript obtain whether the select tag has the multiple (check) attribute? Use js or jq.
The select Check is rare, but it has also been encountered.
Use js :( add your select id to "se ")
If (document. getElementById ("se"). hasOwnProperty ("multiple ")){
Alert ("check ")
} Else {
Alert ("single choice ")
}