javascript - blur event fired on scroll of div on IE -
i have text box user types something, suggestions shown above textbox. these suggestions wrapped inside "div" , can scroll if exceed height.
inputfld.on("blur", function(){ //some code close suggestion div if clicked outside inputfld (with check click on suggestion item) });
thus above code if click outside inputfld, hide "suggestions" div wrapper.
now issue when there lot of suggestion items , scrollbar. if try scroll through items on ie, blur event gets fired , closes suggestions wrapper div.
this not happen on other browsers though.
how handle on ie?
you can try catch clicks , check if click on else suggestion div:
$("body").bind('click', function(e) { var target_div_id = e.target.id; //get id of clicked element if (target_div_id !== 'suggestion_div') { //check whether clicked element = suggestion_div $('#suggestion_div').hide(); } });
Comments
Post a Comment