开发者

Find words in a simple list by typing first letter (like in a standard select-box)

开发者 https://www.devze.com 2023-02-19 11:45 出处:网络
I\'m trying to make new select-boxes with a custom styling instead of the boring standard one using jquery. What it does is that i开发者_Go百科s rewrites the \" + \" into lists.

I'm trying to make new select-boxes with a custom styling instead of the boring standard one using jquery. What it does is that i开发者_Go百科s rewrites the " + " into lists.

Quick example:

<select class="changeSelect">
 <option value="0" selected="selected">Choose now</option>
 <option value="1">aaaaaaaaa</option>
 <option value="2">bbbbbbbbb</option>
 <option value="3">ccccccccc</option>
</select> 

Becomes into:

<ul>
 <li class="first">Choose now</li>
 <li>aaaaaaaaa</li>
 <li>bbbbbbbbb</li>
 <li class="last">ccccccccc</li>
</ul>

Now what I need for it is to jump to the list options when I type the first letter. So if I fx type "b" when the list is active, it will jump to the list "bbbbbbb" (and add a class, highlight or something other..)

But how do I do this?


use this CSS

try this code using pure javascript

autoComplete

How to Use it

0

精彩评论

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

关注公众号