用jQuery模拟select下拉框的简单示例代码(2)

A.each(function (i) {
                if (v.length >= 2) {
                    if ($(this).text().toUpperCase().indexOf(v) == -1) {
                        $(this).parent().hide();
                    }
                    else {
                        $(this).parent().show();
                    }
                }
                if (v.length <= 0) {
                    $(this).parent().show();
                }
            })
            src.val(v);
        }


  $().ready(function(){
   $("#txt_city").keyup(function(){
    search('txt_city','city_select1');
   }).focus(function(){
    showExpand('txt_city','city_select1','expand')
   })

$("#txt_city2").keyup(function(){
    search('txt_city2','city_select2');
   }).focus(function(){
    showExpand('txt_city2','city_select2','expand')
   })
  })

function fnTest(){
   document.getElementById("txtTarget").value = document.getElementById("txtSrc").value;
  }
    </script>
</head>
<body>
    <div>
        <input type="text" value=""  /><a
            href="#">▼</a>
        <div>
            <ul>
                <li><a href="javascript:void(0)">SH 上海</a></li>
                <li><a href="javascript:void(0)">BJ 北京</a></li>
                <li><a href="javascript:void(0)">HZ 杭州</a></li>
                <li><a href="javascript:void(0)">WH 武汉</a></li>
                <li><a href="javascript:void(0)">NJ 南京</a></li>
                <li><a href="javascript:void(0)">WX 无锡</a></li>
            </ul>
        </div>

        <input type="text" value=""  /><a
            href="#">▼</a>
        <div>
            <ul>
                <li><a href="javascript:void(0)">CN 中文</a></li>
                <li><a href="javascript:void(0)">EN 英语</a></li>
                <li><a href="javascript:void(0)">JP 日本</a></li>
                <li><a href="javascript:void(0)">RA 俄语</a></li>
                <li><a href="javascript:void(0)">FA 法语</a></li>
                <li><a href="javascript:void(0)">00 其它</a></li>
            </ul>
        </div>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdyspw.html