$('#dropdown option:selected') not a living object. Your code binds the click handler to the selected parameter when the page loads. You should either use event delegation, or better listen to the change event of the select element.
$('#dropdown').on('change', function() { // Get text content of the selected option var getText = $('option:selected', this).text(); // Get current value of the select element // var getValue = this.value; console.log(getText); console.log($('.overlay-'+getText)); });
source share