// 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-10-27 05:08:55