js獲取下拉框的option 用js獲取select的多個(gè)選項(xiàng)值?
用js獲取select的多個(gè)選項(xiàng)值?以下兩種使用js獲取select的方法如下:VAR obj=document.getElementByIdxX(“testselect”)來定位idvar索引=對(duì)象
用js獲取select的多個(gè)選項(xiàng)值?
以下兩種使用js獲取select的方法如下:VAR obj=document.getElementByIdxX(“testselect”)來定位idvar索引=對(duì)象選擇索引選擇索引變量文本=對(duì)象選項(xiàng)[索引]。text選擇文本變量值=對(duì)象選項(xiàng)[索引]。Value在jQuery中獲取所選select值的第一種方法是$(“#testselect)選項(xiàng):選中"). Text()所選文本$(“#testselect)選項(xiàng):選中"). Val()選定值$(“#testselect”)。獲?。?)。selectedindex索引的第二種方式是$(“#tesetselect”)。查找(“選項(xiàng):選中"). Text()//selected Text.val()…….get(0).selectedIndex