Note: how to disable select controls

Source: Internet
Author: User

As you know, for the select HTML control, there is no readonly encoding,
So setting it does not work, for example:

1 < Select ID = "Select1" Readonly = "Readonly" >
2 < Option Value = "AA" > AA </ Option >
3 < Option Value = "BB" > Bb </ Option >
4 < Option Value = "Cc" > CC </ Option >
5 < Option Value = "DD" > Dd </ Option >
6 </ Select >
7

If disabled is used, the value cannot be obtained at the time of submission.
So what methods can be implemented?
---- I have not found -_-!
However, there can be a compromise method, as shown below:

1 < Select ID = "Select1" Onfocus = "This. defopt = This. selectedindex" Onchange = "This. selectedindex = This. defopt ;" >
2 < Option Value= "AA"> AA </ Option >
3 < Option Value= "BB"> Bb </ Option >
4 < OptionValue= "Cc"  Selected > CC </ Option >
5 < OptionValue= "DD"> Dd </ Option >
6 </ Select >
7

That's all done.
 

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.