having <input name="foo" id="foo"> , change handler blurs input change triggered enter
$('#foo').on('change', function(event) { $(document.body).append('<br>change called'); var $target = $(event.target); if ($target.is(':focus')) { $(document.body).append('<br>input still in focus - calling blur'); $target.blur(); } }); https://codepen.io/ciekawy/pen/olqdng?editors=1111
on safari calling blur triggers additional change (while on chrome not). haven't found reasonable solution handle behaviour. i'd rather not use timer nor flags prevent second entry.
Comments
Post a Comment