I would like to insert some pre-formatted text on to the page, once a custom ribbon action is clicked. But may i know how to find the current cursor position in SharePoint page edit mode, so as to insert the text.

1 Answer 1


Usually this can be done with javascript right ?

function textbox() { var ctl = document.getElementById('Javascript_example'); var startPos = ctl.selectionStart; var endPos = ctl.selectionEnd; alert(startPos + ", " + endPos); }

  • the above is returning "undefined error"
    – Scarlet959
    Oct 5, 2017 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.