This is a migrated thread and some comments may be shown as answers.

[Solved] Keypress event

1 Answer 57 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Phat Nguyen
Top achievements
Rank 1
Phat Nguyen asked on 27 Dec 2010, 10:46 AM
I want close window when press esc, how can i do that?

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 28 Dec 2010, 03:16 PM
Hello Phat,

You can do so by attaching a keydown event handler and closing the window using its close() client-side method:

$(document).keydown(function(e) {
     if (e.keyCode == 27) // esc
         $('#Window1').data('tWindow').close();
})

Greetings,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Phat Nguyen
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or