HTMLGuyLLC / jAlert

jQuery alert/modal/lightbox plugin
https://htmlguyllc.github.io/jAlert/
MIT License
76 stars 35 forks source link

Enter key calls alert over and over opening multiple windows. #60

Closed dperkyone closed 6 years ago

dperkyone commented 6 years ago

I was able to duplicate this using video example and changing the JS scripts to this....

` $(function(){

/ Attach login handler / $(".help").on("click", function(e){

e.preventDefault();

/ Popup an alert with the form / $.jAlert({ "title":"WARNING", "content":"Hitting Enter key will open this window over and over again. You will have to close the window for every time you hit Enter key." }); });

});

` With this in place clicking the help button and then hitting the enter key will open multiple copies of the alert window. You will have to hit escape key or exit button for each copy.

dperkyone commented 6 years ago

I have discovered that if I click on the open alert window before pressing the enter key, this doesn't happen. I think this is a focus issue and the keystroke is being recorded in the main window. But I don't know what to set autofocus to since there are no input fields.

HTMLGuyLLC commented 6 years ago

It's def. your on-click handler.

$(function(){
/* Attach login handler */
$(".help").on("click", function(e){
e.preventDefault();
$(this).blur();
/* Popup an alert with the form */
$.jAlert({
"title":"WARNING",
"content":"Hitting Enter key will open this window over and over again. You will have to close the window for every time you hit Enter key."
});
});
});