select get selected option code example

Example 1: jquery get selected option value

var selectedOptionText = $('#mySelectID').find(":selected").text();//selected option text
var selectedOptionVal = $('#mySelectID').find(":selected").val();//selected option value

Example 2: get text selected option jquery

$('#id option:selected').text()

Example 3: jquery get selected option value

$("select.your-select").change(function(){ 
	$(this).children("option:selected").val();
});

Example 4: get selected option value

var conceptName = $('#aioConceptName').find(":selected").val();

Example 5: javascript get selected option

let selectElement = document.getElementById("selectElement");
let valueSelected = selectElement.options[selectElement.selectedIndex].value; // get selected option value
var text= selectElement.options[selectElement.selectedIndex].text; //get the selected option text

Example 6: use js to get select value

// reference to 'scripts' select list 
// used throughout the examples below
var sel = document.getElementById('scripts');

// display value property of select list (from selected option)
console.log( sel.value );