셀렉트박스 변경 이벤트처리
<select id="selectBox" name="selectTest" onchange="changeSelection()">
<option value="" selected disabled>--선택--</option>
<option value="one">1</option>
<option value="two">2</option>
</select>
- selectBox 이벤트호출 함수에서 ID값으로 선택된 value, text 값 가져오기
function changeSelection(){
let langSelect = document.getElementById("selectBox");
// 선택한 option의 value, 텍스트
let selectVlaue = langSelect.options[langSelect.selectedIndex].value;
let selectVlaueTyp = langSelect.options[langSelect.selectedIndex].text;
}