Get selected option from select element
问题 I am trying to get the selected option from a dropdown and populate another item with that text, as follows. IE is barking up a storm and it doesn't work in Firefox: $('#ddlCodes').change(function() { $('#txtEntry2').text('#ddlCodes option:selected').text(); }); What am I doing wrong? 回答1: Here's a short version: $('#ddlCodes').change(function() { $('#txtEntry2').text($(this).find(":selected").text()); }); karim79 made a good catch, judging by your element name txtEntry2 may be a textbox, if