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 selection is frozen. See fiddle .
source share