javascript - How to measure size of an expanded combo box (select option)? -


when expanding dropdown menu measure size of combo box:

$("select").on("click", function() {     $("#log").html($(this).width() + " " + $(this).height()); }); 

this doesn't work: http://jsfiddle.net/stefek99/jfqjw/

as experiment tried measure size in settimeout: http://jsfiddle.net/stefek99/ppek3/

$("select").on("click", function() {     var $that = $(this);     settimeout(function(){fnmeasuresize($that)}, 1000);  }); 

(and doesn't work)

difficulty setting breakpoints / inspecting elements combo box canny beast collapses. thinking calculating number of items , multiplying line-height.

is there recommended way of getting size?

(both jquery , vanilla js solutions appreciated)

don't think can. dropdown part of list os-dependent , can quite different depending on device. example, on mobile, dropdown portion implemented more of scrolling selector actual fly-out widget.


Comments