Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a bootstrap modal which I want to open for example cltr+v or cltr+shift

What I have tried:

JavaScript
$(document).keydown(function (evt) {
        debugger;
        if ( (evt.ctrlKey) && (evt.shiftKey)) {
            evt.preventDefault();
            $('#AddSubject').modal('show');
            alert("its working");
        }
    });
Posted
Updated 17-Oct-16 22:08pm
v3
Comments
Suket shah 18-Oct-16 3:17am    
HiCan you please try with below code
if (evt.ctrlKey && evt.shiftKey)

1 solution

try this

JavaScript
$(function () {
            $(document).keydown(function (evt) {
                debugger;
                if ((evt.ctrlKey) && (evt.shiftKey)) {
                    evt.preventDefault();                   
                    alert("Ctrl + Shift");
                }
                if ((evt.ctrlKey) && (evt.keyCode ==86)) {
                    evt.preventDefault();
                    alert("Ctrl + v");
                }
            });
        });
 
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