select 获取value及选中值

html


script

  var sel = document.getElementById("sel");
    sel.onchange = function () {
        var index = this.selectedIndex;
        console.log(this.value);
        console.log(this.options[index].text);
    }

你可能感兴趣的:(select 获取value及选中值)