我在用:
我有一个名为Booking_CancellationComments_CancellationPolicy的textarea,并使用以下代码使其成为一个wysihtml5文本区域:
$('#Booking_CancellationComments_CancellationPolicy').wysihtml5(options);稍后,我将尝试使用以下方法更新它:
$('#Booking_CancellationComments_CancellationPolicy').val(data.Booking.CancellationComments.CancellationPolicy);但是textarea没有更新。我看了很多关于堆栈溢出的答案,而没有显示如何使用我使用过的初始化方法更新textarea。
任何帮助都很感激。
发布于 2013-05-28 05:58:44
试试这个:
$('#Booking_CancellationComments_CancellationPolicy').data("wysihtml5").editor.setValue(data.Booking.CancellationComments.CancellationPolicy);
发布于 2016-01-05 23:30:04
//表示编辑器=未定义。构造函数不初始化编辑器。
var wysihtml5 = $("#Booking_CancellationComments_CancellationPolicy").wysihtml5() ;
wysihtml5 = wysihtml5.data("wysihtml5");
wysihtml5.createEditor({}); "create the editor ……
wysihtml5.editor.setValue("some html"); 发布于 2016-01-19 07:55:06
编辑器==“未定义”也有同样的问题,并通过以下方法解决了这个问题:
$('.wysihtml5-sandbox').contents().find('body').html('<b>New text</a>');我知道,这不是最好的解决办法,但只有这个对我有用。如果你有更好的解决办法,请告诉我。
https://stackoverflow.com/questions/16545205
复制相似问题