How to report an error when modifying the type attribute of input in ie8 _ javascript skills

Source: Internet
Author: User
When you select the show plaintext check box, you need to display the password entered by the user in plaintext. If you do not select this box, you need to change the ciphertext. The problem is that the type attribute abstract of the input cannot be modified in ie8:

Now, you need to check the show plaintext check box to display the password entered by the user in plaintext, the first thought was to modify the type of the input box to determine whether to display the plaintext or ciphertext, and use jQuery's attr for testing. The test results are chrome, Firefox, and ie9 +, an error will be reported under ie8. The following reason is found. In ie8, the type attribute of input cannot be modified, and another idea is implemented.

If the text box is selected, replace the input box with type = "text". If the text box is not selected, replace the text box with type = "password". The Code is as follows:

 
Related Article

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.