I am trying to make the hover effect as follows:
<div>Some Text</div>
should be replaced with <select> when hovering over the mouse. as soon as the mouse leaves this selection, it should display either the previously displayed value or the new selected value.
Unfortunately, mouseleave is called when you open the drop-down list to select some options, and I cannot make it work. Has anyone had this problem before and knows a solution?
<div id="text">Some Text</div> <select id="selector" style="display: none"> <option value="1" selected="selected">Some Text</option> <option value="2">Some More</option> <option value="3">Some Other</option> </select>
jQuery:
$("#text").mouseover(function() { $(this).hide(); $("#selector").show(); }); $("#selector").mouseleave(function() { $(this).hide(); $("#text").show(); });
Can someone tell me how I can make sure mouseleave is not called when someone opens a selection and hangs over the parameters?
BTW: it fires when the mouse button is pressed during selection
Frank
source share