We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Event selectionChanged not working

Good day

I have an issue with the selectionChanged event as I doesn't fire when I click into the document editor selection another position.

var documenteditorContainer = new ej.documenteditor.DocumentEditorContainer({ enableToolbar: true,enableSelection: true, enableSearch: true, enableEditor: true, isReadOnly: false, enableOptionsPane: true, height: "100vh", width: "100%"});
let contentChanged = false;

//Inject require modules.
ej.documenteditor.DocumentEditorContainer.Inject(ej.documenteditor.Toolbar,ej.documenteditor.Selection, ej.documenteditor.Search, ej.documenteditor.Editor, ej.documenteditor.OptionsPane);

documenteditorContainer.contentChange = () => {

documenteditorContainer.selectionChanged = () => {

The contentChange event works but the selectionChanged doesn't. I tried it with documenteditorContainer.documentEditor.selectionChanged without any luck.

We are using the EssentialStudio2 Version Javascript.

Please help to resolve this issue. If you need more information let me know.

Best Regards

4 Replies

KM Kavitha Muralitharan Syncfusion Team March 23, 2023 02:24 PM UTC

Hi David,

We have checked with the above code (selectionChange event). We have added simple code to alert with the selection text and attached a screenshot and simple sample for your reference. please cross-check that and let us know if you need any other assistance.

Sample Link: https://stackblitz.com/edit/z2ksfw-x3nkdx?file=index.ts


We suggest you use the select API


Please refer the below documentation link to know more about select API

UG Link:https://ej2.syncfusion.com/documentation/api/document-editor/selection/#select-1


Kavitha M

DT David Tschan replied to Kavitha Muralitharan March 23, 2023 02:29 PM UTC

Hi Thank you so much for your support.

However this doesn't resolve my issue. I change the code now how you suggested but the alert never shows.

I have cleared all my caches. It seems like the selectionChanged event never fires.

As I stated above the contentChange event does fire. So it doesn't seem to be a issue with the events in general but just the selectionChanged event.

Best Regards Da

documenteditorContainer.selectionChanged = () => {
let selectedText = documenteditorContainer.documentEditor.selection.text;
if (selectedText !== undefined && selectedText !== '') {

DT David Tschan March 23, 2023 02:41 PM UTC

I wrote selectionChange​instead of just selectionChange

Issue is resolved. I am sorry

KM Kavitha Muralitharan Syncfusion Team March 28, 2023 01:08 PM UTC

Thanks for the update, David.

We are happy to hear that your issue has been resolved. Please get back to us if you need any other assistance. We would be happy to assist you as always.

Live Chat Icon For mobile
Up arrow icon