Answers for "set value on select javascript"

5

javascript set html select value

// Get the html select element
var select = document.getElementById('<your select element id>');

// If you have a <option> like this:
// <option value="1">My Value Display text</option>

//Then your selected value of your select would be:

select.value = "1";
Posted by: Guest on September-29-2020
5

js select on change value

document.getElementById('my-select').addEventListener('change', function() {
  console.log('You selected: ', this.value);
});
Posted by: Guest on May-14-2020

Code answers related to "set value on select javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language