如何提醒剑道编辑器中选定的文本?我尝试了下面的代码
<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor();
var editor = $("#editor").data("kendoEditor");
var html = editor.getSelection();
</script>但这给了我一个错误:
不能使用“in”运算符搜索未定义的“getSelection”
那么我的文本框是
<textarea id="editor" kendo-editor k-ng-model="html"></textarea>
<script>
var textarea = $("#editor");
textarea.kendoEditor({ value: "Hello, how are you doing !" });
var editor = textarea.data("kendoEditor");
$('#buttonB').click(function () {
alert(textarea);
alert(editor.getSelection());
});
</script>发布于 2018-01-18 13:12:23
使用我在Kendo (https://demos.telerik.com/kendo-ui/editor/events)中看到的内容,添加指定给select事件触发的函数的select属性:
<script>
var textarea = $("#editor");
textarea.kendoEditor({
value: "Hello, how are you doing !",
select: onSelect
});
var editor = textarea.data("kendoEditor");
function onSelect() {
alert(editor.getSelection());
}
$('#buttonB').click(function () {
alert(textarea);
alert(editor.getSelection());
});
</script>https://stackoverflow.com/questions/47787361
复制相似问题