Cancel event fired on clicking the "x" in the editor form

Cancel event fired on clicking the "x" in the editor form

schwaluckschwaluck Posts: 103Questions: 27Answers: 1

Hello everyone,
I want to execute a function when the editor form is aborted by the "x" button. I have already looked if there is a suitable event for this, but I couldn't find one. With the help of the events "close" or "preClose" I could not achieve the required effect.

So does anyone have a suggestion how to execute a function when the "x" was clicked? I expected something like a "cancel" event.^^

Greetings
Daniel

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416

    With the help of the events "close" or "preClose" I could not achieve the required effect.

    Why not? What was the problem?

    If you only want to execute the function in case the change was cancelled with the "x" button you can use your browser's inspector and figure out how to find the button using jQuery or Javascript:

    You would find the "close" button inside a div with the class DTE_Header. All you need is to get the selector right, I guess.

    Something like this could work:

    $('.DTE_Header .close').click(function () {
         ... do something
    });
    
  • rf1234rf1234 Posts: 2,950Questions: 87Answers: 416
    Answer ✓

    Put the jQuery into an Editor event handler to make sure the DOM elements exist when the code is executed. On “opened“ should work for this.

  • schwaluckschwaluck Posts: 103Questions: 27Answers: 1

    Hey rf1234,
    thanks for your reply that looks like it will solve my problem. I will try this out. :)

This discussion has been closed.