select-one selection behavior
by int32_t
HTML
<select id="select1" autofocus>
<option>Apple</option>
<option>Banana</option>
<option>Lemon</option>
</select>
<div>Current value=<span id=value>-</span></div>
<ul id=log></ul>
JavaScript
var s = document.getElementById('select1');
setInterval(function() {
document.getElementById('value').innerHTML = s.value;
}, 300);
function log(mes) {
var li = document.createElement('li');
li.innerHTML = mes;
document.getElementById('log').appendChild(li);
}
s.addEventListener('change', function() {
log('change fired.');
}, false);