我有带有文本区域的简单模式窗口:
<div class="box-modal" id="product_modal">
<div class="box-modal_close arcticmodal-close"><img id="closePopupImage" src="/images/icons/popup_icon_close.png"></div>
<div id="product_fields">
<span class="product_label">{'TEXT_PRODUCT_NAME'|tr}:</span>
<input type="text" class="product_name">
<span>{'TEXT_PRODUCT_PRICE'|tr}:</span>
<input type="text" class="product_price">
<span>{'TEXT_PRODUCT_AMOUNT'|tr}:</span>
<input type="text" class="product_amount">
<br>
<span class="product_label pr_comment">{'TEXT_PRODUCT_COMMENT'|tr}:</span>
<textarea id="product_comment" class="product_comment"></textarea>
<img class="add_one_more" src="/images/icons/add_button.png" title="{'TEXT_ADD_ONE_MORE'|tr}">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我有一个带有 .add_products_btn 类按钮的表。
我的js:
function makeTinyMceEditor() {
tinymce.init({
selector: "#product_comment",
plugins: "link"
});
}
$(".add_products_btn").click(function () {
$("#product_modal").arcticmodal();
makeTinyMceEditor();
});
Run Code Online (Sandbox Code Playgroud)
因此,当我第一次单击按钮时,我的tinymce 工作正常。但是当我单击第二个按钮时,我的tinymce不起作用(认为是因为每次单击按钮时textarea的id都是相同的)。如何从编辑器中删除旧的 id 实例以便再次使用它们?
谢谢。