【发布时间】:2014-03-06 07:50:25
【问题描述】:
我需要在 firefox 扩展中使用它,所以我没有使用 Jquery,这是我的代码:
var label = document.createElementNS(XUL_NS, "label"); // create a new XUL label
label.setAttribute("value", actionLabel);
label.setAttribute("class", "label-title");
var description = document.createElementNS(XUL_NS, "description");
description.setAttribute("id", actionId);
description.appendChild(label);
description.innerHTML=actionText;
输出应该是:
<description id=actionId> <label class="label-title" value=actionLabel/> This is a long section of text that will word wrap when displayed. </description>
【问题讨论】:
-
你可以使用 .innerText 和/或 .textContent,见quirksmode.org/dom/w3c_html.html#t07
标签: javascript html dom xul