4

How can i expand/open the select option on mouseover using jquery to show all the items in the select list?

    <select size="3" id="something">
       <option value="1">.1..</option>
       <option value="2">.2..</option>
 <option value="3">.3..</option>
    </select>
user244394
  • 13,168
  • 24
  • 81
  • 138
  • This answer also said "no" -- http://stackoverflow.com/questions/430237/is-it-possible-to-use-js-to-open-an-html-select-to-show-its-option-list – Won Feb 13 '13 at 19:12
  • @Minime unless you use the Chosen plugin linked in my comment – Matt Busche Feb 13 '13 at 19:13

1 Answers1

7

Do you mean something like this.

$('select').hover(function(){
    var count = $(this).children().length;
    $(this).attr('size', count);
},function(){
    $(this).removeAttr('size');
});

This will add and remove the size attribute when the select is hovered over. See this fiddle.

Blake Plumb
  • 6,779
  • 3
  • 33
  • 54
  • on mouseover i want the select to just openup/expand and show all its items/lists – user244394 Feb 13 '13 at 19:18
  • @user244394 I am sorry but a standard select doesn't support this functionality. The best I can think of is to get the the number of children in the select and expand it to that size. – Blake Plumb Feb 13 '13 at 19:46