How To Close Combobox When Onmouseout? May 27, 2023 Post a Comment How to close combobox when onmouseout? Volvo Saab Solution 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(); Copy Although, 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... <select onmouseover="size = 5" onmouseout="size = 0"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> Copy This 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. <script type="text/javascript"> function clickSelect(element) { var event = document.createEvent('MouseEvents'); event.initMouseEvent('mousedown', true, true); element.dispatchEvent(event); }; function toggleSelect() { clickSelect(document.getElementById("select")); } </script> <form> <select id="select"> <option>one</option> <option>two</option> </select> <input type="button" onmouseover="toggleSelect();" value="toggle select state" /> </form> Copy Share Post a Comment for "How To Close Combobox When Onmouseout?" Top Question Firefox, Chrome, Safari Have Grey Background For Mp4 Html5 Video Any video (that I can make) with a white background becomes… Red Border Still Appears On Inputs After Resetting An HTML 5 Form Firefox I have an HTML 5 form! Great, I'm excited! I decide to … Svg Animation And Firefox I'm struggle with SVG animation drawing, which is work … How To Save Html5 Geolocation Data To Python Django Admin? Is it possible to save the javascript html5 geolocation lat… How To Hide/show Tabs Using Jquery I have four tabs.On loading only the first tab is opened an… Form To Iframe Submission - How Do You Reset The Form After File Upload? I have a form that submits the results to an iframe. The su… 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 Display A Python String As Html In Jupyter Notebook In IPython notebook, I used to be able to display a python … How To Add Placeholder Field? I've been trying to add placeholder in input type='… Bounce Animation On A Scaled Object What is the best way to have an object scale and then perfo…