I want to limit execution with hit enter only to specific div, not on whole page so that this enter key not impact to divs outside this #targer-wrapper but code below with checking div length didn't works:
if ($('#targer-wrapper').length) {
$('#targer-wrapper').on('keydown', '#children-input', function (e) {
value = $('input#children-input').val();
if (value.length >= 3) {
functionName();
} else if (e.which === 13 || e.keyCode === 13) {
functionName();
}
});
}
Thanks for help and suggestion