This is what it looks like:
CopyCode The Code is as follows: 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:
Copy code The Code is as follows: 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:
Copy code The Code is as follows: 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:
Copy code The Code is as follows: 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:
Copy code The Code is as follows: VaR _ Val = $ (": Radio [name = 'input1'] [checked]"). Val ();
In this way, it is normal in various browsers. It is estimated that the test conducted by jquery1.3.2 on IE8 is not comprehensive enough. We hope the next version can solve this problem.