I used this code to handle to event , but I want to fire one time if both of them or one of them occur.
$(document).on("keypress blur", ".pollOptionInput", function(e) {
if (e.type == 'focusout' || e.keyCode == 13) {
e.preventDefault();
addPollOption();
$('.btnAdd').focus();
}
});
My code fire two time if I press enter key . how can I solve my problem ?