// test var selectEl = document.querySelector(‘select‘) var buttonEl = document.querySelector(‘button‘) selectEl.addEventListener(‘change‘, function() { console.log(this.value) }) buttonEl.addEventListener(‘click‘, function() { selectEl.options[1].selected = true })
时间: 2024-12-28 07:50:40