我在bootstrap中有一個關閉(x)按鈕,我無法使用javascript顯示。一旦我給它的類名稱close
它消失。是什麼賦予了?無法獲取Bootstrap關閉按鈕以顯示
var btn = document.createElement("button"); //<button> element
btn.className("close"); <!-- unless commented out it won't show -->
var t = document.createTextNode("x"); <!-- would rather use × but this will work for now -->
btn.setAttribute("class", "close"); <!-- tried this and didn't work either -->
cell4.appendChild(btn);
參考我想這一類從引導
button.close {
-webkit-appearance: none;
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
}
打開你的開發工具(點擊F12)並檢查元素。您將看到所有正在應用的CSS。這會告訴你你的問題在哪裏。 –
什麼是您的CSS代碼(不是引導程序)? – crazymatt
我沒有任何我自己的,我試圖將自舉代碼應用到它。 – john