Jquery 1.3.2 IE8 fetch radio questions

Source: Internet
Author: User
I found that jquery 1.3.2 has a small problem in IE8.

Recently, the new version of jquery, Version 1.3.2, was used in the project. It is found that this version does not support radio input in IE8 very well, this is what it looks like:

 

Javascript Code
    1. VaR_ Val = $ ("Input [name = 'input1'] [checked]"). Val ();

VaR _ Val = $ ("input [name = 'input1'] [checked]"). Val ();

 

The result shows that the value of _ Val is undefined. At first, I thought it was wrong. Check that there is no problem, in this way, values can be normally obtained in IE6, 7, FF, chrome, opera, and Safari, that is, IE8 does not work. I was puzzled. Later I tried again:

 

JavaScript code
    1. VaR_ Val = $ ("Input [name = 'input1']"). Eq (0). Val ();

VaR _ Val = $ ("input [name = 'input1']"). eq (0). Val ();

 

The value can be obtained, indicating that the problem may occur on the checked attribute of Radio. Try again:

 

JavaScript code
    1. VaR_ Val = Document. getelementsbyname ("Input1") [0]. getattribute ("Checked");

VaR _ Val = Document. getelementsbyname ("input1") [0]. getattribute ("checked ");

 

The values in IE6, 7, FF, chrome, opera, and Safari are true or false, while those in IE8 are empty,

In IE8:

 

JavaScript code
    1. VaR_ Val = Document. getelementsbyname ("Input1") [0]. checked;

VaR _ Val = Document. getelementsbyname ("input1") [0]. checked;

 

It can be set to true or false. I don't know if this is an IE8 bug or does Microsoft have a deep idea?

Last use:

 

JavaScript code
    1. VaR_ Val = $ (": Radio [name = 'input1'] [checked]"). Val ();

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.