Get selected option from select element

后端 未结 12 982
温柔的废话
温柔的废话 2020-12-08 01:45

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:

<
12条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 01:56

    Try this:

    $('#ddlCodes').change(function() {
      var option = this.options[this.selectedIndex];
      $('#txtEntry2').text($(option).text());
    });
    

提交回复
热议问题