javascript - How can I not react to blur event on YUI autocomplete select -
i trying react diffrently onblur , onselect events yui autocomplete. need hide ac, when user clicks somewhere else , leave there on select. problem is, blur event fired onselect well. not find event triggered when clicking outside ac , stuck catching blur event in way in case of select since fired before select event.
so want output like:
click outside ac: blur
select value: select val
but getting is:
click outside ac: blur
select value: blur, select val
which leads hidden ac on select.
since blur event fires when select something, , it's won't able prevent that, on blur set timeout. if timer times out, on blur.
in select event, cancel timer.
some loose pseudo code:
var blurtimer = null; function handleblur() { blurtimer = settimeout(function() { // onblur }, 50); } function handleselect() { cleartimeout(blurtimer); // normaly on select }
Comments
Post a Comment