Error : “Invalid argument”,“Code 0” on IE8 in Jquery

廉价感情. 提交于 2019-12-11 05:07:51

问题


I'm using Jquery in my project. Everything works good on Firefox, but on IE, I get error saying "Invalid argument","Code 0". I found that the line

$(thisObj).css({'border':'1px dotted transparent;'});

is causing problem.

Is there any other way to set the css ?

Also, in the same project, I'm using styleSheet object. I have completed the functionality and it works on Firefox. Now, While I tested on IE, I needed to change some property names to make it working. What can be the best way to make it working for IE also. Do I need to rewrite the functions for IE ?

Thanks in advance.


回答1:


i usually use $(thisObj).css('border','1px dotted transparent'); syntax




回答2:


When using a setting call to .css() you shouldn't include the trailing semi colon on the value, as you would in a normal bit of CSS.

$(thisObj).css({'border':'1px dotted transparent;'});
                                                |
                                      //remove this semi-colon

$(thisObj).css({'border':'1px dotted transparent'});

I've just quickly tested this on my work IE7 machine here, and adding a semi-colon to any .css() call of this nature instantly breaks it with the error message you are quoting.



来源:https://stackoverflow.com/questions/4203881/error-invalid-argument-code-0-on-ie8-in-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!