Search code examples
javascripthtmlonmouseoverselectlistmouseclick-event

How to drop a select list by 'onmouseover'?


How can I drop down a select list with onmouseover instead of clicking it. Select list cannot be clicked in javascript to emulate that. eg: onmouseover="(this.click())"

Also setting the 'size of select list' = 'its length' in javascript does not accurately emulate the click event because the adjacent layout changes. I tried using z-index and position attribute but doesn't help.


Solution

  • Here's a clever hack from an oldish devshed post

    Select box expand onMouseOver - Dev Shed

    here's an example in action:

    http://jsfiddle.net/87nyG/1


    Personally I'd prefer a 3rd party or custom solution as opposed to hacking the <select> element