Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I have written some global key press events which will be common in all the pages.
Now I want to over write that a key press event in global events with an another event.
Suppose in the global event for key "Ctrl" i have action as "Alert('Hi')"; So in one of the page I want to over write this as "Alert('Hello');
How can I achieve that?
Posted
Comments
Mahesh Bailwal 13-Feb-14 6:59am    
Can you share your code snippet?
Member 10562609 13-Feb-14 7:03am    
Hi Mahesh,
This is my code in js file
$(document).ready(function () {
$(document).mapHotKeys(
[
{
key: 'shift+ctrl', action: function () { alert('Blocked by hotkeys.'); }
}
]
);
});

And in the aspx page i want to implement

$(document.body).keydown(function (event) {
// save status of the button 'pressed' == 'true'



if (keys["shift"] && keys["ctrl"]) {

alert('Shift + Ctrl override');
keys["shift"] = false;

}

});
The problem I am facing is it is showing both the alert messages. Actually I am new to Jquery so I am not able figure out what is wrong.

1 solution

you can have return statement as false.
try it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900