Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Select a option of a select element with JQuery

<script>
  	$(document).ready(function() {
  		$("#status option[value='value']").attr("selected", true);
	});
</script>
Comment

selected select html jquery

<select id="menu">
   <option value="1">Opción 1</option>
   <option value="2">Opción 2</option>
   <option value="3">Opción 3</option>
</select>
<script >
  $(function () {
     $("#menu option[value='2']").attr("selected", true);
  });
</script>
Comment

jquery selected option

$( "#myselect option:selected" ).val();
Comment

select option value jquery

$("select.country").change(function(){
  var selectedCountry = $(this).children("option:selected").val();
  alert("You have selected the country - " + selectedCountry);
});
Comment

option selected jquery

$('select option[value=8272]').attr('selected', '');
Comment

jquery selected option value

$(document).ready(function(){
    $("select.country").change(function(){
        var selectedCountry = $(this).children("option:selected").val();
        alert("You have selected the country - " + selectedCountry);
    });
Comment

jquery selected option value

 let payment_type = $("#olca_form_submit select[name='payment_type']")
      .find(":selected")
      .val();
Comment

jquery option selected

$('.selDiv option:eq(1)').prop('selected', true)
Comment

select selected option value jquery

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

selected value jquery

$(this).val(); //in jquery it returns the selected value
Comment

jquery select option value selected

$("div.id_100 select").val("val2").change();
Comment

select selected value jquery

If you want to get the selected option text, you can use $(select element). text() . var text = $('#aioConceptName option:selected'). text();
If you want to get selected option value, you can use $(select element). val() . var val = $('#aioConceptName option:selected').val();
Comment

PREVIOUS NEXT
Code Example
Javascript :: datatables get all rows 
Javascript :: NodeJS get rootpath of our project 
Javascript :: diff two arrays javascript 
Javascript :: hot reload problem react 17 
Javascript :: js get last element of an array 
Javascript :: what is ngmodel property binding 
Javascript :: how to remove last digit from number in javascript 
Javascript :: regex for non empty string 
Javascript :: json foreach in javascript 
Javascript :: npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! functions@ lint: `tslint --project tsconfig.json` 
Javascript :: output in javascript 
Javascript :: useref array of refs 
Javascript :: how to do radio button validation in jquery 
Javascript :: import react icons 
Javascript :: javascript object tostring 
Javascript :: how to use if in setstate 
Javascript :: javascript string contains 
Javascript :: javascript get closest element by class 
Javascript :: puppeteer evaluate pass variable 
Javascript :: new line in p tag react 
Javascript :: how to remove middle characters in string javascript 
Javascript :: ionic status bar color 
Javascript :: remove duplicate json object from array javascript 
Javascript :: referenceerror window is not defined ckeditor 
Javascript :: jquery find checkbox by value 
Javascript :: convert string in hh:mm am/pm to date js 
Javascript :: lodash sumby 
Javascript :: set datetime-local value javascript 
Javascript :: iframe reload parent page 
Javascript :: sort by string react 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =