javascript - How to add multiple event delegation in jquery with focusout -
i trying execute 2 events 1 "on" function. have code:
<input type="text" id="lesson" /> $('#lesson').on("focusout keyup",function(e){ var $change_education = $(this); if(e.which === 188){ var current_value = $(this).val(); add_edit_tags(current_value, $change_education); } });
the keyup event working focusout not. can't see web how solve this.
thanks
the problem seems checking e.which === 188
not set if focusout
event, change condition below , check
$('#lesson').on("focusout keyup",function(e){ var $change_education = $(this); if(e.type == 'focusout' || e.which === 188){ var current_value = $change_education.val(); add_edit_tags(current_value, $change_education); } });
demo: fiddle
Comments
Post a Comment