I'm trying to execute the default event of a button before executing my custom function
my code:
$('#Button').click( function (){
sideMenuCheck();
});
I wan't this to be executed after the default event of the function Like this:
$('#Button').click( function (){
**event.default();**
sideMenuCheck();
});
but I didn't find any solution.
Not important
I'm doing this because I have an off-canvas menu, and menu has to be with the visible height after it opens, (#Button) is the button that opens menu from the side.
I'm trying to execute the default event of a button before executing my custom function
my code:
$('#Button').click( function (){
sideMenuCheck();
});
I wan't this to be executed after the default event of the function Like this:
$('#Button').click( function (){
**event.default();**
sideMenuCheck();
});
but I didn't find any solution.
Not important
I'm doing this because I have an off-canvas menu, and menu has to be with the visible height after it opens, (#Button) is the button that opens menu from the side.
Share Improve this question asked Nov 10, 2014 at 11:07 iYazee6iYazee6 86612 silver badges22 bronze badges 1- 1 I guess you should instead ask question regarding your former issue, not the workaround you think would fix it – A. Wolff Commented Nov 10, 2014 at 11:24
1 Answer
Reset to default 10You can wrap up your code in a setTimeout
with a timeout of 0
- this will cause it to move your code to the bottom of the execution queue, and allow everything else to run first:
$('#Button').click( function (){
window.setTimeout(function() {
sideMenuCheck();
}, 0);
});