javascript - Prevent event from triggering together with another event -
i have google.maps event handler
google.maps.event.addlistener('place_changed', function(){ ... })
attached input (which autocomplete) , handler attached same input
input.addeventlistener('change', function(){ ... })
how can prevent change triggering place_changed? accurate, if place_changed dont trigger change , not vice versa.
i tried
google.maps.event.addlistener('place_changed', function(){ input.addeventlistener('change', function(){ return 0; }) })
but didn't help
so read want not trigger event a when event b being triggered?
that's pretty easy:
window.e_called = false; function e1() { window.e_called = true; // event 1 code... } function e2() { window.settimeout(function() { if(!window.e_called) { // event 2 code... } window.e_called = false; }, 1); }
you of course have bind e1()
, e2()
, stuff, hope understand solution.
Comments
Post a Comment