开发者

How do I force a scrollbar in a <select> to go to the top of the list?

I have this HTML:

<select multiple='multiple' size='3'>
    <option>1</option>
    <option&开发者_开发问答gt;2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
</select>

Using jQuery how do I force the scrollbar in the select to go to the top?


$("select").scrollTop(0)

Should work, and, depending upon your browser, might work. But I would not count on it. It does not work in Safari 4, but does work in Firefox 3.5.9

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜