what i'm trying to do is to pass a value from selected option that i have choose, to another option tag in another form by clicking a checkbox
and then to this form
what i have done is:
$('input[name=sameKTP]').change(function() {
if($('input[name="sameKTP"]').is(':checked')) {
$(this).prop('checked',true);
$('#domcAddressDataSubmit').val($('#ktpAddressDataSubmit').val());
$('#domcStateId').val($('#ktpStateId').val());
$('#domcCityId').val($('#ktpCityId').val());
$('#domcDistrictId').val($('#ktpDistrictId').val());
$('#domcSubDistrictId').val($('#ktpSubDistrictId ').val());
$('#domcRtDataSubmit').val($('#ktpRtDataSubmit').val());
$('#domcRwDataSubmit').val($('#ktpRwDataSubmit').val());
} else {
$(this).prop('checked',false);
$('#domcAddressDataSubmit').val('');
$('#domcStateId').val('');
$('#domcCityId').val('');
$('#domcDistrictId').val('');
$('#domcSubDistrictId').val('');
$('#domcRtDataSubmit').val('');
$('#domcRwDataSubmit').val('');
}
});
this code could only pass a value that have a type=text field not a value in option tag
How can I do this the best way?