Home >Web Front-end >JS Tutorial >Javascript gets the current value of select sample code (compatible with IE/Firefox/Opera/Chrome)_javascript skills
JavaScript获取Select当前值写法:
var value = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].value;
var text = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].text;
例子: