SoFunction
Updated on 2025-04-09

Implementation code for getting the position index of the current cursor in kindEditor

Haha, this means he has a way to get the cursor position, and then he followed the clues and found it and took it out to share it.

The following part is all.
Copy the codeThe code is as follows:

var editor;(function () {
editor = ("#txt_content");
alert();}
);

Also: I also found that there is one, I don’t know what it is for. Which brother knows and give me some advice. Thank you.

Answer: startOffset is the start position, then endOffset should be the end position, so we can get the selected text.