私はまだ鋭い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>