I'm displaying a simple Bootstrap modal with a 'checkout' button at the bottom.
On clicking the button I want to:
I can't seem to find a way of chaining without it instantly running the next function, e.g.
$('#myModal').modal('hide').each(function() {
window.location.href = '/checkout';
});
or I thought delay() might help, e.g.
$('#myModal').modal('hide').delay(1000).each(function() {
window.location.href = '/checkout';
});
That doesn't work either it just changes page instantly.
Is this a common jQuery issue? Or will I have to extend Bootstrap to handle this?
There's an event called hidden
when twitter bootstrap modal is completely hidden. So you can do something like this:
$('#myModal').bind('hidden', function(){
window.location.href = '/checkout';
}).modal('hide');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With