想要实现一个效果,动态添加一些样式到style标签中
于是这么写:
<style id="tt"></style>
....
$("#tt").append(".a{float:left;}");
在ie8下面append方法报错
unexpected call to method or property access
只能用原生的js方法:
var tt= document.getElementById("tt");
if(tt.style.cssText){
tt.style.cssText = ".a{float:left;}";
}