Jquery gets a sample introduction to the difference between colors in ie and ff

  • 2020-03-30 02:29:22
  • OfStack

When using $("#id").attr("color") to get the color, ie and ff are different. Here's a simple example:
<font id="id" color="green"> 

Using $("#id").attr("color") in ff,chrome gets the value "green" and ie gets the value "#008000".

So if you use attr("color") to determine the current color, you need to determine both the color name and the corresponding color code for compatibility. Such as:
if($("#id").attr("color") == "green" || $("#id").attr("color") == "#008000" ){ 
alert("this color is green!!"); 

Related articles: