A problem can occur if you use a form and sweet alert together, the code below can be adjusted to overcome this fix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
var previousWindowKeyDown = window.onkeydown; swal({ title : "delete file?", text : "Do you want to delete it?", type : "warning", showCancelButton : true, confirmButtonColor : "#27C24C", confirmButtonText : "Yes", cancelButtonText : "No ", closeOnConfirm : false, closeOnCancel : false }, function (isConfirm) { window.onkeydown = previousWindowKeyDown; if (isConfirm) { swal('Great', 'Deleted :)', 'success'); } else { swal("Dont Worry", "File left alone", "success"); } }); |
OR you can hash this…..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
var myfocus=1; $('body').keyup(function(e) { var code = e.keyCode || e.which; if (code == '9') { if (myfocus==1) { myfocus=2; $('#priceform').focus(); } else { $('#feeform').focus(); myfocus=1; } } }); |