Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js Changing selected option by option text

const changeSelected = (e) => {
  const text = 'Steve Jobs';
  const $select = document.querySelector('#mySelect');
  const $options = Array.from($select.options);
  const optionToSelect = $options.find(item => item.text ===text);
  optionToSelect.selected = true;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript page loader 
Javascript :: can we pass variable to a object 
Javascript :: noscript you need to enable javascript to run this app. /noscript 
Javascript :: how to fetch web page source code with javascript 
Javascript :: javascript startdate end date 
Javascript :: angular multiple validator pattern single input 
Javascript :: add text to innerhtml javascript 
Javascript :: npm html-validate 
Javascript :: import json file in the same directory as javascript 
Javascript :: const justCoolStuff = (arr1, arr2) = arr1.filter(item = arr2.includes(item)); 
Javascript :: jquery-3.5.1.min.js download 
Python :: abc list 
Python :: pyspark import col 
Python :: postgres django settings 
Python :: python subtract months from date 
Python :: how to shutdown a computer with python 
Python :: convert column in pandas to datetime 
Python :: check if message is in dm discord.py 
Python :: install xgboost 
Python :: matplotlib equal axis 
Python :: python sigmoid function 
Python :: python open mat file 
Python :: numpy print full array 
Python :: install streamlit 
Python :: plt.imshow grayscale 
Python :: django previous url 
Python :: check 32 or 64 bit python 
Python :: find text between two strings regex python 
Python :: python reimport py file 
Python :: how to print hello world 10 times in python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =