Home > Web Front-end > JS Tutorial > jquery 1.3.2 Some minor problem solutions in IE8_jquery

jquery 1.3.2 Some minor problem solutions in IE8_jquery

WBOY
Release: 2016-05-16 18:50:22
Original
1158 people have browsed it

It looks like this when used:

Copy the code The code is as follows:

var _val = $("input[name='input1'][checked]").val();

It turns out that the value of _val is undefined. I thought it was written incorrectly at first. You can check it. No problem, the value can be obtained normally in IE6, 7, FF, Chrome, Opera, and Safari, but not in IE8. I was puzzled by the solution, and then I experimented:

Copy the 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 in the checked attribute of the radio , experiment again:

Copy code The code is as follows:

var _val = document. getElementsByName("input1")[0].getAttribute("checked"); The value of

is true or false in IE6, 7, FF, Chrome, Opera, Safari, but in IE8 Is empty,
in IE8:

Copy code The code is as follows:

var _val = document.getElementsByName("input1")[0].checked;

can be set to true or false. I don’t know if this is a bug in IE8 or if Microsoft has other intentions?
Final use:

Copy code The code is as follows:

var _val = $(":radio[name='input1'][checked]").val();

This works fine on various browsers. It is estimated that the testers of jquery1.3.2 The testing of IE8 is not comprehensive enough, I hope the next version can solve this problem.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template