如何清除数学化的可编辑元素的内容? [英] How to clear content of mathquillified editable element?
问题描述
我正在使用mathquill渲染一些乳胶. 我有一个可编辑的mathquill元素.
I'm using mathquill to render some latex. I have an editable mathquill element.
我想知道如何以编程方式清除内容.
I would like to know how to programmatically clear the content.
当我手动清除它(退格键)时,一切正常,但是如果我使用jQuery从DOM中删除元素,则似乎使用了一些缓存,因为我得到的旧值已被新值污染.
When I manually clear it (backspace), everything works fine but if I remove elements from the DOM with jQuery it seems like some cache is used since I get old values contatenated with the new ones.
有人可以帮我吗?
谢谢
推荐答案
您可以将id设置为可编辑字段,如下所示:
You can put an id to the editable field like this:
<span id="main-input-solution">
之后,您可以像这样在javascript中创建一个函数:
After that you can create a function in javascript like this:
function clearContent(){
var mathFieldSpan1 = document.getElementById('main-input-solution');
mathFieldSpan1.innerHTML = "";
}
此功能可以调用例如按钮单击事件.
This function you can call e.g on button click event.
这篇关于如何清除数学化的可编辑元素的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!