开发者

HTML: Prevent hide of options in select

Is it possible not to hide options when I select item in 'select'? I need to append more options to 'select' when user click on 'op2' item, but without closing option list.开发者_JAVA百科

<select>
<option>op1</option>
<option>op2</option>
</select>


This is an HTML option : size="x"

<select id="test" size="5">
    <option>op1</option>
    <option>op2</option>
    <option>op3</option>
    <option>op4</option>
    <option>op5</option>
    <option>op6</option>
</select>

You can then set the said size using jQuery :

$("select#test").attr("size",$("select#test > option").length);

DEMO HERE


<select multiple> might be what you want.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜