Modified JavaScript to allow the select element