<div class="text">hello, world!!</div>
<div class="text">fuck the world</div>
<div class="text">fuck everything</div>
<select></select>
const texts = document.querySelectorAll('.text');
const select = document.querySelector('select');
select.innerHTML = Array
.from(texts, n => `<option>${n.innerText}</option>`)
.join('');
select.value = null;
select.addEventListener('change', ({ target: { selectedIndex } }) => {
texts.forEach((n, i) => n.classList.toggle('active', i === selectedIndex));
});