jquery selected option value
var selectedOptionText = $('#mySelectID').find(":selected").text();//selected option text
var selectedOptionVal = $('#mySelectID').find(":selected").val();//selected option valueBY LOVE
$('#ddlName option:selected').val(); $("#mySelect option:selected").html();$("select.country").change(function(){
var selectedCountry = $(this).children("option:selected").val();
alert("You have selected the country - " + selectedCountry);
});$('.id_100 option[value=val2]').attr('selected','selected');
$(document).ready(function(){
$("select.country").change(function(){
var selectedCountry = $(this).children("option:selected").val();
alert("You have selected the country - " + selectedCountry);
});
Also in JavaScript:
- d3js circle out of scrren
- iterate object js
- ad data to js object
- drupal tag filter ajax content
- puppeteer block request javascript
- select a form by name jquery
- how to run p5js in a particular section of page
- get value in tag with id JS
- create array javascript fill
- vue get height of element ref
- react render for loop
- set up background process in express app
- javascript get index of object with value in array
- drupal 8 get page node
- month name array javascript
- jquery selector checked
- route react
- javascript remove object from array
- how to edit a fil with vanilla js
- ajax datatable reload paging retained
- Unexpected end of JSON input while parsing near '...fcd15e632426a1be","ta'
- setting property to method in child class javascript
- javascript extract date from string
- react native scrollview