1. Vanilla JS

var target = document.getElementById("id태그");
var selectedText = target.options[target.selectedIndex].text;
var selectedValue = target.options[target.selectedIndex].value;
console.log(`selectedText : ${selectedText}, selectedValue : ${selectedValue}`);

 

2. jQuery

var selectedText = $("#id태그 option:selected").val()
var selectedValue = $("#id태그 option:selected").text()
console.log(`selectedText : ${selectedText}, selectedValue : ${selectedValue}`);

 

Tag. 자바스크립트 select 값, 자바스크립트 select 문자, 자바스크립트 select value, 자바스크립트 select text, javascript select 값, javascript select 문자, javascript select value, javascript select text

+ Recent posts