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 @ 2011-09-26 17:18  walleyekneel  阅读(1544)  评论(0编辑  收藏  举报