How to obtain the option text value in javascript (used in firefox)

Source: Internet
Author: User
How does javascript get the text value of option (used in firefox)

There is no innerText in Firefox, so it is difficult to obtain the option text (not the value) in firefox. I will summarize the solutions and code in my project. Please advise.

Knowledge point:

0. Why innerText? Security problems

1. Extend attributes for the firefox dom Model

2. The currentStyle attribute can get the actual style status.

3. The display mode is taken into account when IE implements innerText. If it is block, a line break is added.

4. Why not use textContent? Because textContent does not consider the display method of elements, it is not fully compatible with IE.

Code: IE6, 7,8, and firefox 2 and 3 are all tested.

        

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.