Home >Web Front-end >JS Tutorial >Regarding the compatibility issues of juqery radio writing method (old and new versions of jquery)_jquery

Regarding the compatibility issues of juqery radio writing method (old and new versions of jquery)_jquery

WBOY
WBOYOriginal
2016-05-16 18:24:591159browse

As follows:

Copy code The code is as follows:

$("input[name='isIel' ][checked]").val()
$("[name='isIel'][checked]").val()
==

The above are only suitable Lower versions of IE (IE6 and below)
Higher versions of IE or Firefox need to be changed to
$("input[name='isIel']:checked").val()

Test jquer Version 1.4, 1.3.2

How to obtain radio in old and new versions of juqery
Today I changed to a higher version of jquery and found that the original method that was running normally reported an error. After careful search The method of obtaining radio with jquery is as follows:

New version (currently 1.3.2, 1.4.2):

$("[name='radio_name'] [checked]").val(), or $("input[name='radio_name']:checked").val()

Old version:

$("[@name='radio_name'][checked]").val(), or $("[@name='radio_name']:checked").val()

different The reason is that the old version has an extra @ symbol
PS: When upgrading jquery, it is best to check some information first to improve efficiency.
Statement:
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