๐:-1
You need to place the ID test
on the select box and not the option.
Change
document.getElementById('test').addEventListener('click', function() {
To
document.getElementById('test').addEventListener('change', function(e) {
now you can access the value of the change by e.target.val
and decide what data you want to insert / remove based on the user interaction.