1

How to open the select without a mouseclick. I need on mousemove opening:

<select id="sel" onmouseover="???open the option list??" onmouseout="???close the option list??">
    <option>One</option>
    <option>Two</option>
    <option>Three</option> 
</select>

Also jquery's $('#sel').trigger('mousedown'); doesn't work. I don't want mousover="this.size=3" onmouseout="this.size=1". Can somebody give a simple code?

The Process
  • 5,913
  • 3
  • 30
  • 41
user2301515
  • 4,903
  • 6
  • 30
  • 46
  • Have a look at http://stackoverflow.com/questions/19432610/jquery-open-select-by-button, they are trying to tie it to a button, but the concept should be about the same. – TheGentleman Mar 25 '16 at 12:59
  • I'm pushing back duplication indictments. I a long time searched solutions for it. No working solution cannot found, so i asked again. – user2301515 Mar 25 '16 at 13:08
  • Also a proverb says, that we are not hitting the questioner's mouth. – user2301515 Mar 25 '16 at 13:13

2 Answers2

0

open dropdown list from javascript function

Is it possible to use JS to open an HTML select to show its option list?

Can I open a dropdownlist using jQuery

Looks like the answer is no. Except if it only has to work in Chrome:

HTML

<select id="sel" class="dropdown">
    <option>One</option>
    <option>Two</option>
    <option>Three</option> 
</select>

JS

var dropdown = document.querySelector('.dropdown');
var event = new MouseEvent('mousedown');

dropdown.dispatchEvent(event);
Community
  • 1
  • 1
Pimmol
  • 1,871
  • 1
  • 8
  • 14
-3

you can use jquery to handle it.

$( "div" ).mousemove(function( event ) {
  //do whatever you want
});

jquery works fine for me :) https://api.jquery.com/mousemove/

gm-br
  • 30
  • 10