jQuery搜索框下拉菜单分类选择代码

jQuery搜索框下拉菜单分类选择代码-精品资源网
jQuery搜索框下拉菜单分类选择代码
此内容为免费资源,请登录后查看
0
免费资源

jQuery搜索框下拉菜单分类选择代码

一款比较常用的jQuery搜索框下拉菜单分类选择代码,对选择的栏目分类进行搜索。

js代码

  <script>
    $(function(){
        $(\".select_box\").click(function(event){   
            event.stopPropagation();
            $(this).find(\".option\").toggle();
            $(this).parent().siblings().find(\".option\").hide();
        });
        $(document).click(function(event){
            var eo=$(event.target);
            if($(\".select_box\").is(\":visible\") && eo.attr(\"class\")!=\"option\" && !eo.parent(\".option\").length)
            $(\'.option\').hide();                                    
        });
        $(\".option li\").click(function(){
            var check_value=$(this).text();
            var zlValue = $(\'.option li:eq(1)\').html();
            var bqValue = $(\'.option li:eq(2)\').html();
            $(this).parent().siblings(\".select_txt\").text(check_value);
            $(\"#select_value\").val(check_value);
            if(check_value == zlValue) {
                $(\'#searchPlaceholder\').prop(\'placeholder\',\'请输入电器名称\');
            }else if(check_value == bqValue) {
                $(\'#searchPlaceholder\').prop(\'placeholder\',\'请输入家用名称\');
            }else {
                $(\'#searchPlaceholder\').prop(\'placeholder\',\'请输入服装名称\');
            }
        });
    })
  </script>

© 版权声明
THE END
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容