Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Keyboard shortcut to launch modal window... #41

Closed
webmastervinay opened this issue Jul 16, 2013 · 2 comments
Closed

Keyboard shortcut to launch modal window... #41

webmastervinay opened this issue Jul 16, 2013 · 2 comments
Labels

Comments

@webmastervinay
Copy link

0 down vote favorite

I am uing your link for integrating keyboard short cuts.. It redirects to the given URL after pressing the key..

jwerty.key('f2', function () {
window.location = document.getElementById('SaleLink').href;
});

I am using following code to launch the bootstrap modal window :

[a href=PopUp.php?Id=1 data-toggle="modal" data-target="#myModal">Open</a]

$('#myModal').modal({ show: false});
$('#myModal').on('hidden', function () {
    console.log('modal is closed');
})
$("a[data-toggle=modal]").click(function (e) {
lv_target = $(this).attr('data-target');
lv_url = $(this).attr('href');
$(lv_target).load(lv_url);
}); 

It works fine when i click on the link...i am trying to add this code to launch the modal window when i press a key say f2 ...since it redirects directly to the given URL therefore the modal window is not opening....Can you please suggest any solution for this??

@keithamus
Copy link
Owner

You need to simulate the click of the link instead of changing window.location, so your code should be

jwerty.key('f2', function () {
    $('#SaleLink').click();
});

@webmastervinay
Copy link
Author

thanks a lot keithamus!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants