jQuery select添加图标

 //下拉菜单样式
        /*查找全部select的下拉菜单*/
        function getElemsById(cot_val){
            return document.getElementById(cot_val);
        }
        var sel= getElemsById("c_select");
        var wrap= getElemsById("sel_wrap");
        var result=wrap.getElementsByTagName("span");
        sel.onchange=function(){
            var opt=this.getElementsByTagName("option");
            var len=opt.length;
            for(i=0;i<len;i++){
                if(opt[i].selected==true){
                    var cot_val = opt[i].innerHTML;
                }
            }
            result[0].innerHTML = cot_val;
        }
        /*查找文本查找图片*/
        var sel_two = getElemsById("c_select_two");
        var result_two = getElemsById("spl");
        sel_two.onchange=function(){
            var opts=this.getElementsByTagName("option");
            var lens=opts.length;
            for(i=0;i<lens;i++){
                if(opts[i].selected==true){
                    var cot_vals = opts[i].innerHTML;
                }
            }
            result_two.innerHTML = cot_vals;
        }

 

posted @ 2017-03-20 09:38  Lonely,lonelyBurning  阅读(3349)  评论(0编辑  收藏  举报