Home > Web Front-end > JS Tutorial > body text

Example introduction to the difference between jquery getting color under ie and ff_jquery

WBOY
Release: 2016-05-16 16:54:11
Original
1154 people have browsed it

When using $("#id").attr("color") to get the color, ie and ff are different. Take a simple example:

Copy code The code is as follows:



Use $("#id").attr("color") to get the value "green" in ff and chrome, and in ie The value obtained is "#008000".

So, if you use attr("color") to determine the current color, considering compatibility, you need to determine the color name and the corresponding color code at the same time. For example:
Copy code The code is as follows:

if($("#id"). attr("color") == "green" || $("#id").attr("color") == "#008000" ){
alert("this color is green!!");
}
Related labels:
ff ie
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