【发布时间】:2019-01-31 16:12:52
【问题描述】:
我有一个 JS 函数,可以在变量更改时更新产品描述。这里是元素更新的地方。
Product.Config.prototype.updateProductShortDescription = function(productId) {
var shortDescription = this.config.shortDescription;
if (productId && this.config.childProducts[productId].shortDescription) {
shortDescription = this.config.childProducts[productId].shortDescription;
}
$$('#product_addtocart_form div.short-description').each(function(el) {
el.innerHTML = shortDescription;
});
};
效果很好,但希望将输出包装在 div 中。有谁知道在更新前将 innerHTML 包装在标签中的方法吗?
谢谢。
【问题讨论】:
-
可能是
wrap方法? -
请为您的问题添加所有相关代码,以便我们更好地帮助您:html、js ....
标签: javascript innerhtml