How To Close Combobox When Onmouseout? November 20, 2023 Post a Comment How to close combobox when onmouseout? VolvoSaabSolution 1: You can't do this (reliably). The popup that appears is not available to manipulate, ie open or close, programmatically and its behaviour is defined by the browser (or operating system). To expand on this further, both IE and Firefox can close the popup by blurring the select element:selectEl.blur(); CopyAlthough, the mouseout event fires even when you move the mouse to the options in the popup, so it would require a bit of hackery magic. In Chrome it will blur the select element but the box will remain open.It's generally best to leave the behaviour of UI components alone, so that users get the experience they expect through interaction with your website. Solution 2: You can do a little trick like this...<selectonmouseover="size = 5"onmouseout="size = 0"><optionvalue="volvo">Volvo</option><optionvalue="saab">Saab</option><optionvalue="mercedes">Mercedes</option><optionvalue="audi">Audi</option></select>CopyThis will expand the menu on mouse over then collapse it when you move out.Edit: This can cause issues with placement of other elements if you're not careful.Solution 3: A couple of years late but in case someone else is looking at this...I was able to toggle the open/close state of a select element in Chrome by sending it a mouse click. In this example moving the mouse over the toggle button will toggle the state of the <select>. This is a toggle, not an explicit open or close, but worked for me.<scripttype="text/javascript">functionclickSelect(element) { var event = document.createEvent('MouseEvents'); event.initMouseEvent('mousedown', true, true); element.dispatchEvent(event); }; functiontoggleSelect() { clickSelect(document.getElementById("select")); } </script><form><selectid="select"><option>one</option><option>two</option></select><inputtype="button"onmouseover="toggleSelect();"value="toggle select state" /></form>Copy Share Post a Comment for "How To Close Combobox When Onmouseout?" Top Question Display None If Null Using Data-id I have a menu which list items which display the the conten… Firefox, Chrome, Safari Have Grey Background For Mp4 Html5 Video Any video (that I can make) with a white background becomes… Html5 Audio, Web Audio Api, Cors And Firefox I have been trying to get this to run correctly so days now… Change Font Color And Background In Html On Mouseover I'm using a small piece of inline HTML code to change t… IE11 Textarea Loses Focus If Another Textarea Is Disabled In this fiddle, using ie11 with open Console, input somethi… Javascript. Onclick Returns Always The Same Object I have got 16 divs of the same class name in html document … Homepage Slow To Load When I go to the homepage of my website after clearing my c… Make Fully Visible One Element From Overflow:hidden Element Please check http://jsfiddle.net/mtN6R/9/ .tooltip{ col… How To Limit The HTML Table Records In Each Page I am populating a table in my jsp which has more than 20 re… How To Limit The Html Table Records In Each Page I am populating a table in my jsp which has more than 20 re… December 2024 (1) November 2024 (39) October 2024 (50) September 2024 (16) August 2024 (209) July 2024 (195) June 2024 (406) May 2024 (689) April 2024 (442) March 2024 (874) February 2024 (958) January 2024 (843) December 2023 (878) November 2023 (384) October 2023 (614) September 2023 (277) August 2023 (316) July 2023 (254) June 2023 (346) May 2023 (200) April 2023 (144) March 2023 (135) February 2023 (172) January 2023 (255) December 2022 (136) November 2022 (215) October 2022 (181) September 2022 (161) August 2022 (293) July 2022 (87) Menu Halaman Statis Beranda © 2022 - Html5 School