0

I open my app in a new window. In this app I prevent some default events actions for my actions. But when I close the window I want activate the default event actions.

Is there a command how to restore ALL events back to default actions.

How I prevent an default event

preventDefault = function(e) {
e = e || window.event;
if (e.preventDefault) {
    e.preventDefault();
}
e.returnValue = false;
};
2
  • What do you mean you want to "activate" them after you close the window. When it's closed, it's closed. Nothing is active in that window any more. Commented Feb 21, 2013 at 12:42
  • Sorry for the bad explenation but I actually open the content in a new Dojo dialog. Commented Feb 21, 2013 at 12:43

1 Answer 1

1

If we are talking about the same JavaScript window object in which you open different Dojo views - as we clarified, you could use a condition in your event handler. E.g. you have a handler function like:

function handleClick(e) {

  if(window._preventDefault) {

    // prevent default action

  }

  // handle event
}

Then you could control whether to prevent defaults globally by changing the _preventDefault global variable so after

window._preventDefault = false;

The assigned handlers would not prevent default but if you set that variable to true then they would.

Sign up to request clarification or add additional context in comments.

1 Comment

Such a simple sollution and it works. I actually did it a bit different but used the concept from you. Thank you!

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.