1 回答

TA貢獻1921條經驗 獲得超9個贊
我能夠使用 bootstrap 和 javascript 來完成此操作,我使用 js 是為了避免 Visual Studio 出現一些小問題,因為編譯器不允許我將 class 屬性放入 bootstrap 工具提示的 title 屬性中。
這是代碼:
<a id="information" data-toggle="tooltip"? data-html="true">
? ?<span><i class="fas fa-info-circle" style="color: #ff9900"></i></span>
</a>
function info() {? ?
? ? var infoTooltip = document.getElementById("information");
? ? infoTooltip.setAttribute("title",
? ? ? ? `
? ? ? ? <table>
? ? ? ? ? ? <thead>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th>Colores</th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? </thead>
? ? ? ? ? ? <tbody>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th><span class="badge badge-danger px-2">Emergencia</span></th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th><span class="badge badge-warning px-2">Urgencia</span></th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th><span class="badge badge-success px-2">Urgencia Menor</span></th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th><span class="badge badge-primary px-2">Sin Urgencia</span></th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? ? ? ? <th><span class="badge badge-light px-2">Comprado</span></th>
? ? ? ? ? ? ? ? </tr>
? ? ? ? ? ? </tbody>
? ? ? ? </table>
? ? ? ? `
? ? );
}
這就是結果。
- 1 回答
- 0 關注
- 107 瀏覽
添加回答
舉報