我有一个id ="myTextArea"的文本区域,我能够获取文本区域的内容,但是一旦用户成功提交数据,我就无法清除内容.我正在使用wysihtml5插件作为我的文本编辑器.我的代码如下.
<textarea name="def_text" id="myTextArea" class="textarea"></textarea>
Run Code Online (Sandbox Code Playgroud)
在我的jquery文件中,一旦用户成功提交数据,我就会按照以下方式进行操作.
$('#myTextArea').val('');
Run Code Online (Sandbox Code Playgroud)
但它没有清除文本区域.我已经尝试了$('#myTextArea').html(''),但它对我不起作用.
你可以参考这篇非常好的文章:https://askgif.com/blog/142/how-to-get-wysihtml5-textarea-content-cleared/
尝试使用
$('#myTextArea').data("wysihtml5").editor.clear();
Run Code Online (Sandbox Code Playgroud)
这对我来说很好.
归档时间: |
|
查看次数: |
1666 次 |
最近记录: |