IE中的option元素的jQuery位置始终为0,0

时间:2016-12-02 07:39:20

标签: javascript jquery google-chrome internet-explorer

对于选择元素:

<select id="s1" size="4">
    <option>o1</option>
    <option>o1</option>
    <option>o1</option>
    <option>o1</option>
  </select>

以下代码始终在IE 11中返回0 0但在Chrome中返回26 9:

  var selectelem = document.getElementById("s1");
  var children = selectelem.querySelectorAll("option");
  console.log($(children[1]).position().top + " " + $(children[1]).position().left);

有没有办法解决这个问题?

0 个答案:

没有答案