Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery WYSIHTML5文本区域内容未被清除_Jquery_Wysihtml5 - Fatal编程技术网

Jquery WYSIHTML5文本区域内容未被清除

Jquery WYSIHTML5文本区域内容未被清除,jquery,wysihtml5,Jquery,Wysihtml5,我有一个文本区域id=“myTextArea”,我能够获取文本区域的内容,但一旦用户成功提交数据,我就无法清除内容。我使用wysihtml5插件作为我的文本编辑器。 我的代码如下 <textarea name="def_text" id="myTextArea" class="textarea"></textarea> 但它并没有清除文本区域。 我也尝试过$('#myTextArea').html(''),但它对我不起作用。你可以参考这篇非常好的文章:(礼貌:) 试

我有一个文本区域id=“myTextArea”,我能够获取文本区域的内容,但一旦用户成功提交数据,我就无法清除内容。我使用wysihtml5插件作为我的文本编辑器。 我的代码如下

<textarea  name="def_text"  id="myTextArea" class="textarea"></textarea>
但它并没有清除文本区域。
我也尝试过$('#myTextArea').html(''),但它对我不起作用。

你可以参考这篇非常好的文章:(礼貌:)

试用

$('#myTextArea').data("wysihtml5").editor.clear();

这对我来说很好。

我刚刚用wysihtml5创建了自己的clear textarea。如果其他解决方案不起作用,请尝试此方法

$('.wysihtml5-sandbox, .wysihtml5-toolbar').remove();

    $("#yourTextArea").wysihtml5({
            toolbar: {
            "link": false,  //removing link button
            "image": false,  //removing imagelink button
        }
        });

$('#yourTextArea').show();
$('#yourTextArea').val('');
$('.wysihtml5-sandbox, .wysihtml5-toolbar').remove();

    $("#yourTextArea").wysihtml5({
            toolbar: {
            "link": false,  //removing link button
            "image": false,  //removing imagelink button
        }
        });

$('#yourTextArea').show();
$('#yourTextArea').val('');