我正在嘗試爲當前項目創建一個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
對不起,對這裏的評論系統不是很熟悉:) –