javascript select option based on text
var textToFind = 'Google';
var dd = document.getElementById('MyDropDown');
for (var i = 0; i < dd.options.length; i++) {
if (dd.options[i].text === textToFind) {
dd.selectedIndex = i;
break;
}
}
Also in JavaScript:
- sum prime numbers javascript
- using aria attributes in angular
- using this to get name of the clicked element
- javascript enter event listener
- jquery ajax
- javascript node await .click
- ngmodel component angular
- how to filter array objesct in express node js
- javascript queryselector
- get and set es6
- how to change css with js
- jquery scroll when object appear on screen make animation
- string javascript concatenation
- js unshift vs push
- insert into array js
- how to format unix timestamp javascript
- angular pipe for 2 decimal places
- Remove all child nodes of a list:
- javascript conver time into 24 hour format
- add condition inside a className in reactjs
- js append to array
- disable mouse right click javascript
- javascript resize event
- javascript sort array of objects by key value ascending and descending order