我在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>
答案 0 :(得分:0)
这完成了这项工作:
description.insertBefore(标签,description.firstChild);