multiple select element - onchange

后端 未结 9 1983
栀梦
栀梦 2021-02-18 22:50

I have a select element that allows for multiple selections. I\'d like to display the selected values in another part of the page (in a div or something) as the user makes chang

9条回答
  •  粉色の甜心
    2021-02-18 23:09

    This works:

    var MyControl = document.getElementById('Control_ID');
    var newValue = MyControl[MyControl.selectedIndex].value;
    

    Of course, Control_ID is the ID of the select control.

提交回复
热议问题