我尝试从输入字段复制值并将其发送到另一个onkeyup
,但它只提取值而不发送。
function populateSecondTextBox() {
document.getElementById('cepAddressRouteTransporter').value = document.getElementById('postal_code').value;
}

<form action="transporter/route" method="post" role="form">
<table id="address">
<tr>
<td class="label">Zip code</td>
<td class="wideField">
<input class="field" id="postal_code" name="postal_code" onkeyup="populateSecondTextBox();">
</td>
</tr>
</table>
<div class="input-field col s6">
<i class="material-icons prefix">directions</i>
<input placeholder="Ex: 18214-780" id="cepAddressRouteTransporter" name="cepAddressRouteTransporter" type="text" class="validate">
<label for="cepAddressRouteTransporter">CEP:</label>
</div>
</form>
&#13;
答案 0 :(得分:0)
替换为我工作的头部或身体功能。
function populateSecondTextBox() {
document.getElementById('cepAddressRouteTransporter').value =
document.getElementById('postal_code').value;
}
答案 1 :(得分:0)
做最简单的事情
onkeyup="document.getElementById('cepAddressRouteTransporter').value = this.value;"
如上所述更改你的onkeyup函数调用。