How to refactore this
$("#txtShippingAddressFullName").change(function () {
$("#txtBillingAddressFullName").val($(this).val());
})
$("#txtShippingAddress").change(function () {
$("#txtBillingAddress").val($(this).val());
})
$("#txtShippingPostalCode").change(function () {
$("#txtBillingPostalCode").val($(this).val());
})
$("#txtShippingPhoneNumber").change(function () {
$("#txtBillingPhoneNumber").val($(this).val());
})
$("#ddlShippingCity").change(function () {
$("#ddlBillingCity").val($(this).val());
})
I try to use an array like this and looping to bind all event but it isn't work
var control = [
{ source: "txtShippingAddressFullName", destination: "txtBillingAddressFullName" },
{source : "txtShippingAddress" , destination : "txtBillingAddress"},
{source : "txtShippingPostalCode" , destination : "txtBillingPostalCode"},
{source : "txtShippingPhoneNumber" , destination : "txtBillingPhoneNumber"},
{source : "ddlShippingCity" , destination : "ddlBillingCity"}
];