Textarea editor Redactor. Insert value with jQuery

2019-06-18 04:58发布

Have field textarea id="tr" using HTML editor Redactor last version trying to set value of the field exactly haw it is described in API Doc :

$('#tr').redactor('insertText', 'text'); 

or

$('#tr').redactor('insertHtml', 'text');

What am I doing wrong ?

1条回答
老娘就宠你
2楼-- · 2019-06-18 05:32

Try the set API, which I think is a lower-level version of insertText/insertHtml.

So in your example, it should be:

$('#tr').redactor('set', 'Your text goes here');

Update: In redactor version 10 (and greater), the name of the set method was changed, as documented here:

$('#tr').redactor('code.set', 'Your text goes here');
查看更多
登录 后发表回答