我正在尝试为当前项目创建一个jquery treeview插件。插件可以在这个时候与Firefox运行良好;但是,在使用IE浏览器运行时,所有CSS样式都无法应用。例如,我在css文件#button {...}中定义,然后当我使用id =“button”生成控件时,它无法从css中检索样式。我该如何解决这个问题?将css样式应用于jquery插件
这是我的一些代码
在js文件
createControls = function() {
nDiv = document.createElement("div");
nTxt = document.createElement("input");
nTxt.setAttribute('id','txtAdVal');
nTxt.setAttribute('type','text');
nTxt.setAttribute('style' , "width:300px");
nBut = document.createElement("button");
nBut.innerHTML = "Show Active Directory Tree";
nBut.setAttribute("class", "button");
nDiv.appendChild(nTxt);
nDiv.appendChild(nBut);
$(nBut).bind('click', function(event) {
createTree();
});
return nDiv;
};
,并在CSS文件
.button{...}
您可以发布您的代码和相关信息? – Blender
将其编辑到您的问题中。此外,格式化您的代码。突出显示它并按下“Ctrl + K”。 – Blender
对不起,对这里的评论系统不是很熟悉:) –