Getting the height of an option element with javascript?

后端 未结 4 895
梦谈多话
梦谈多话 2020-12-12 07:55

As usual, option elements are shown when a select element is clicked and I\'d like to get the height of the option elements.

Thanks.

Edit @d

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 08:10

    I believe this is what you want

    $(document).ready(function () {
      $("#mySelect").change(function () {
        alert($(this.options[this.selectedIndex]).height());
      });
    });
    

    Here is a demo http://jsfiddle.net/xf3wD/

提交回复
热议问题