select_event_remove_on_click.html   [plain text]


<!DOCTYPE html>
<html>
<body>
<div id="message"></div>
<select id="s" autofocus>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<script>
function handler(e) {
  document.getElementById('message').innerText += "click";
  select = document.getElementById('s');
  select.parentNode.removeChild(select);
}

document.getElementById('s').addEventListener('click', handler);
</script>
</body>
</html>