jquery 遍历下拉框

             jQuery:
                $("select:[id='test'] option").each(function () {
                   alert( $(this).text());
                })

 

            js:

            var opt = document.getElementById("test");
                for (var i = 0; i < opt.length; i++) {
                if (opt[i].selected == true) {
                alert(opt[i].innerText);
                }
             }

posted @   walleyekneel  阅读(1545)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示