Home > Web Front-end > JS Tutorial > What to do if IE8 does not support the jQuery version?

What to do if IE8 does not support the jQuery version?

coldplay.xixi
Release: 2020-11-30 11:48:19
Original
1712 people have browsed it

Solution to the problem that IE8 does not support the jQuery version: You can load the corresponding version of jQuery by determining the version of the IE browser. Only IE8 can recognize [], and some compatible operations can be performed in IE8 mode.

What to do if IE8 does not support the jQuery version?

The operating environment of this tutorial: windows7 system, jquery2.0.2 and jquery1.11.1 versions. This method is suitable for all brands of computers.

Solution to the problem that IE8 does not support the jQuery version:

You can load the corresponding version of jQuery by determining the version of the IE browser

Use statement<!--[if IE 8]> Only recognized by IE8<![endif]--> Some compatible operations can be performed in IE8 mode. The code is as follows:

  <!--[if !IE]> -->
        <script src="/Scripts/jquery-2.0.2.min.js"></script>
    <!-- <![endif]-->
    <!--[if lte IE 8]>
         <script src="/Scripts/jquery-1.11.1.min.js"></script>
    <![endif]-->
   
     <!--[if gt IE 8]>
         <script src="/Scripts/jquery-2.0.2.min.js"></script>
    <![endif]-->
Copy after login

Explanation:

If it is not IE, use 2.02, IE8 and above also use 2.0.2, IE8 and below use version 1.11

Other matters:

1. I originally wanted to use if else, but I heard that else is not recommended, so I used two if

2. I see that the code for judging non-IE is a little different. The following is the explanation:

In non-IE, the following code is recognized as a comment and will be ignored:

<!--[if IE]>
Non-IE browsers ignore this
<![endif]-->
Copy after login

But the following code is different, there is a sentence sandwiched between the two comments Code, will be ignored in IE, but will be recognized in non-IE.

<!--[if !IE]-->
IE ignores this
<!--[endif]-->
Copy after login

Related learning recommendations: javascript video tutorial

The above is the detailed content of What to do if IE8 does not support the jQuery version?. For more information, please follow other related articles on the PHP Chinese website!

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