<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.append(...Array.from(texts, n => new Option(n.textContent)));
select.value = null;
select.addEventListener('change', ({ target: { selectedIndex } }) => {
texts.forEach((n, i) => n.classList.toggle('active', i === selectedIndex));
});