我还不是一个敏锐的 jquery / javascript 编码器 - 所以我希望那里有一个善良的灵魂,他可以帮助我将 javascript 重写为 jQuery 脚本。
代码如下所示:
<script type="text/javascript">
function update_delivery_address()
{
elm_true = document.getElementById('delivery_same_as_invoice_true');
elm_false = document.getElementById('delivery_same_as_invoice_false');
if (!elm_true.checked && !elm_false.checked)
{
elm_true.checked = true;
}
if (elm_true.checked)
{
document.getElementById('delivery_name').value = '';
document.getElementById('delivery_att').value = '';
document.getElementById('delivery_address').value = '';
document.getElementById('delivery_zipcode').value = '';
document.getElementById('delivery_city').value = '';
document.getElementById('delivery_email').value = '';
document.getElementById('delivery_name').disabled = true;
document.getElementById('delivery_att').disabled = true;
document.getElementById('delivery_address').disabled = true;
document.getElementById('delivery_zipcode').disabled = true;
document.getElementById('delivery_city').disabled = true;
document.getElementById('delivery_email').disabled = true;
}
else
{
document.getElementById('delivery_name').disabled = false;
document.getElementById('delivery_att').disabled = false;
document.getElementById('delivery_address').disabled = false;
document.getElementById('delivery_zipcode').disabled = false;
document.getElementById('delivery_city').disabled = false;
document.getElementById('delivery_email').disabled = false;
}
}
update_delivery_address();
</script>