我有一个小脚本可以复制下拉列表中的内容。But I want the drop to display the firstname and when the firstname is selected I want it to copy the lastname outside. 我需要使用除VALUE
JS:
function copy() {
document.getElementById("label").innerHTML =
document.getElementById("mySelect").value
}
HTML:
<div id="label"></div>
<select id="mySelect" onchange="copy();">
<option value="">Select a person:</option>
<option value="firstname" id="lastname">Firstname</option>
<option value="firstname" id="lastname">Firstname</option>
<option value="firstname" id="lastname">Firstname</option>
<option value="firstname" id="lastname">Firstname</option>
</select>