How to Use the select label multiple Attribute

Source: Internet
Author: User

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 ")
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.