Reputation: 3638
I have a html link in which a modal window will be opened while clicking manually. Am using nyromodal, i want the modal window function to get triggered when the shortcut of ctrl+Q is pressed. the shortcut works well when we give just an alert. but not opening the modal.
I tried to trigger the modal function by defining the modal function in the shortcut. But no use. It will be fine if i can click the link dynamically using a jquery function. hopefully that might work. :( no ideas though. Any ideas and help thoughts are welcomed
shortcut.add("Ctrl+Q",function() {
$('.nyroModal').nyroModal();
});
The usual modal function is
$(function() { $('.nyroModal').nyroModal(); });
It works fine when the link with class nyroModal is clicked but not with the shortcut
<a href="new_creation.php" class="nyroModal">Componenets</a>
Upvotes: 1
Views: 227
Reputation: 21882
You might want to look into this function which will handle shortcuts.
Upvotes: 0
Reputation: 2912
What about this:
$(function(){
$('.nyroModal').nyroModal();
shortcut.add("Ctrl+Q",function() {
$('a.nyroModal').click();
});
});
Upvotes: 3
Reputation: 7021
How about:
shortcut.add("Ctrl+Q",function() {
$('.nyroModal').click();
});
Upvotes: 3