I am trying to do a hover effect as follows:
<div>Some Text</div>
should be substituted by a <select>
upon mouseover. as soon as the mouse leaves that select it should display either the value previously displayed or the new selected value.
Unfortunately the mouseleave is called when you open the dropdown to select some options and I cannot get it to work. Has anyone had this problem before and knows the 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>
the jQuery:
$("#text").mouseover(function()
{
$(this).hide();
$("#selector").show();
});
$("#selector").mouseleave(function()
{
$(this).hide();
$("#text").show();
});
Can anyone let me know how I can make sure that the mouseleave isn't called when somebody is opening the select and hovers over the options?
BTW: It does work when the mousebutton is being pressed during the selection