0
我正在嘗試在JavaScript中的按鈕中創建引導工具提示。向javascript中的按鈕添加'數據切換'屬性
這就是我想要實現:
<input type="image" src="~/images/icon_trash_red.png" class="m-l-20" onclick="RemoveItem(this)" height="20" data-toggle="tooltip" data-placement="right" title="Remover aluno" />
這是我到目前爲止有:
button = document.createElement("Input");
button.src = "/images/icon_trash_red.png";
button.width = '20';
button.type = 'image';
button.onclick = function() {
RemoveItem(this);
};
button.style.marginLeft = '70px';
button.title = "Remover aluno";
button.setAttribute("data-toggle", "tooltip");
的「的setAttribute」似乎是工作的罰款,因爲如果我改變像這樣:button.setAttribute("height", "50px");
它的工作原理。
任何想法我做錯了什麼?
我已經這麼做了。 – perozzo
@Perozzo那麼當屬性被添加時,你的問題是什麼? – Alex
@Perozzo:你可以在小提琴中分享代碼嗎? –