tags:

views:

96

answers:

1

This is my script to get color tag ! Which works in Firefox but in IE shows error.

<code>

document.documentElement.className += 'js_active';
jQuery.noConflict();

jQuery(document).ready(function(){

  jQuery(".color_tag_cloud a").each(function(){
  var links = jQuery(this).attr("href");
   jQuery(this).removeAttr("title");
   jQuery(this).attr("title",jQuery(this).text());

    if(links.indexOf("?")!=-1){
    var query =links.split("=")[1];
    var str = "#".concat(query);
     jQuery(this).css("background",str);
    }else{
    var color = links.split("colors/")[1];
    var query = color.split("/")[0];
    var str = "#".concat(query);
    jQuery(this).css("background",str);
    }
  });

 jQuery(".color_tag_cloud a").hover( function() {
   jQuery(this).stop().animate({"opacity": "0.2"}, "slow");
    },function() {
   jQuery(this).stop().animate({"opacity": "1"}, "slow");
 });
});

and my html is look like this.

<code><div class="color_tag_cloud">
<a href="http://www.freecssshowcase.com/colors/e30074/"&gt;PINK&lt;/a&gt;
.......
</div>

</code>
+2  A: 

Your script is setting some invalid hex color codes with the jQuery's css method, and IE is complaining about this.

Log the values of your str variable, and you will see:

invalid-colors-codes.png

CMS