开发者

What determines autoselect for <select>?

I have a <select> tag with various options, and I would like to know what determines what happens when the user starts typing.

Say I have a list like the following:

开发者_Python百科
<select id="userlist"> 
<option value="nothing" selected="selected"></option> 
<option value="AdamT">Adam T</option> 
<option value="AidanC">Aidan C</option> 
<option value="IanQ">Ian Q</option> 
<option value="JamesR">James R</option> 
</select>

Sometimes if I type A followed by I, I end up with Aidan C selected.

Other times, if I type just fractionally slower, I end up with Ian Q selected.

What determines what ends up being selected, and at what speed of typing? Is it browser-specific, or is it set in the HTML spec?


That is browser or OS specific, depending if the browser uses native or custom widgets, I think.

There is certainly nothing in the HTML spec about it.


The < select > is setup so that it performs a new autocomplete in about 1000 milisecond intervals between key presses. If you keep typing before the timer is up, it will continue the autocomplete with your current prefix. However, if you wait a second between key presses, it will start a new prefix, forgetting what you previously typed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜