Home  >  Article  >  Web Front-end  >  Simple sample code to simulate select drop-down box with jQuery_jquery

Simple sample code to simulate select drop-down box with jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 17:02:221186browse

Many times, artists find the default select drop-down box ugly (especially the drop-down arrow button on the right), and they usually like to use a custom icon to replace this button. In this way, I can only use js div to simulate it. After a lot of trouble, I simulated it with jQuery. Of course, there are many such articles on the Internet, but I am too lazy to look for it

Copy code The code is as follows:




   
    自己实现的下拉框
   
   
   


   

                    href="#" onclick="showExpand('txt_city','city_select1','expand')">▼
       

           
       


                    href="#" onclick="showExpand('txt_city2','city_select2','expand')">▼
       

           
       

  

  

  
  

  
   





无图无真相,真相在此:

不足之处:
1、按键盘上下键时,没有高亮的自动移动
2、键入文字自动过滤结果时,感觉相对原生的select有些不自然
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn