modal over another modal without accepting the shortcut of each other

0

I have a modal, which opens another modal, so alright, I put a shortcut ctrl + alt + c to cancel, until then, okay, only I want it when I open the second modal, and click on the shortcut Only he closes and not both, is it possible ???

This is my js

    $(document)
        .on(
                'keydown',
                function(e) {

                    if (e.ctrlKey && e.altKey
                            && e.which === 67) {
                        document.getElementById(
                                "btnCancelar").click();

                    }
if (e.ctrlKey && e.altKey
                        && e.which === 67) {
                    document.getElementById(
                            "btnCancelar1").click();

                }
    }); 

and with that I only put the id in my html. if anyone can help me ??

canceling from modal 1

<button style="color: black;" type="button" class="btn btn-default" ng-click="limparCampos();" data-dismiss="modal" id="btnCancelar">Cancelar</button>

canceling from modal 2

<button style="color: black;" type="button" class="btn btn-default" data-dismiss="modal" id="btnCancelar1">cancelar</button>
    
asked by anonymous 08.03.2018 / 17:38

0 answers