Back to Top
jQuery('.manufacturer input[name=manufacturer]').on('change',function(){
var manufacturer = jQuery(".manufacturer input[name=manufacturer]");
var manufacturerChecked = manufacturer.filter(":checked").val();
if(manufacturerChecked =="ไม่ใช่ที่เดียวกับสถานประกอบการ"){
jQuery('.manufacturer_address').show();
jQuery('.manufacturer_address input').prop('required',true);
}else{
jQuery('.manufacturer_address').hide();
jQuery('.manufacturer_address input').val('');
jQuery('.manufacturer_address input').prop('required',false);
}
});
jQuery('input[name="product_highlights1"]').on('change',function(){
var product_highlight1 = jQuery(jQuery('input[name="product_highlights1"]')[0]);
var product_highlight1_checked = product_highlight1.val();
if(product_highlight1_checked == 1){
jQuery('.product-highlights1_txt').show();
jQuery('.product-highlights1_txt input').prop('required',true);
}else{
jQuery('.product-highlights1_txt').hide();
jQuery('.product-highlights1_txt input').val('');
jQuery('.product-highlights1_txt input').prop('required',false);
}
});
jQuery('input[name="product_highlights2"]').on('change',function(){
var product_highlight2 = jQuery(jQuery('input[name="product_highlights2"]')[0]);
var product_highlight2_checked = product_highlight2.val();
if(product_highlight2_checked == 1){
jQuery('.product-highlights2_txt').show();
jQuery('.product-highlights2_txt input').prop('required',true);
}else{
jQuery('.product-highlights2_txt').hide();
jQuery('.product-highlights2_txt input').val('');
jQuery('.product-highlights2_txt input').prop('required',false);
}
});
jQuery('input[name="product_highlights3"]').on('change',function(){
var product_highlight3 = jQuery(jQuery('input[name="product_highlights3"]')[0]);
var product_highlight3_checked = product_highlight3.val();
if(product_highlight3_checked == 1){
jQuery('.product-highlights3_txt').show();
jQuery('.product-highlights3_txt input').prop('required',true);
}else{
jQuery('.product-highlights3_txt').hide();
jQuery('.product-highlights3_txt input').val('');
jQuery('.product-highlights3_txt input').prop('required',false);
}
});
jQuery('input[name="product_highlights4"]').on('change',function(){
var product_highlight4 = jQuery(jQuery('input[name="product_highlights4"]')[0]);
var product_highlight4_checked = product_highlight4.val();
if(product_highlight4_checked == 1){
jQuery('.product-highlights4_txt').show();
jQuery('.product-highlights4_txt input').prop('required',true);
}else{
jQuery('.product-highlights4_txt').hide();
jQuery('.product-highlights4_txt input').val('');
jQuery('.product-highlights4_txt input').prop('required',false);
}
});
jQuery('.distribution_channel_online input[name="distribution_channel_online"]').on('change',function(){
var distribution_channel_online = jQuery(jQuery('input[name="distribution_channel_online"]')[0]);
var distribution_channel_online_checked = distribution_channel_online.val();
if(distribution_channel_online_checked == 1){
jQuery('.distribution_channel_online_facebook').show();
jQuery('.distribution_channel_online_instagram').show();
jQuery('.distribution_channel_online_twitter').show();
jQuery('.distribution_channel_online_line').show();
}else{
jQuery('.distribution_channel_online_facebook').hide();
jQuery('.distribution_channel_online_instagram').hide();
jQuery('.distribution_channel_online_twitter').hide();
jQuery('.distribution_channel_online_line').hide();
jQuery('.distribution_channel_online_facebook input').val('');
jQuery('.distribution_channel_online_instagram input').val('');
jQuery('.distribution_channel_online_twitter input').val('');
jQuery('.distribution_channel_online_line input').val('');
}
});
jQuery('.distribution_channel_offline input[name="distribution_channel_offline"]').on('change',function(){
var distribution_channel_offline = jQuery(jQuery('input[name="distribution_channel_offline"]')[0]);
var distribution_channel_offline_checked = distribution_channel_offline.val();
if(distribution_channel_offline_checked == 1){
jQuery('.distribution_channel_offline_choice').show();
}else{
jQuery('.distribution_channel_offline_choice').hide();
jQuery('.distribution_channel_offline_choice input[name="distribution_channel_offline_choice"]').prop('checked', false);
}
});
jQuery('.vendor_register_type input[name="vendor_register_type"]').on('change',function(){
if(jQuery('input[name=vendor_register_type]:checked').val() == "บุคคลธรรมดา"){
jQuery('.vendor_id_card').show();
jQuery('.vendor_id_card2').hide();
jQuery('.vendor_id_card2 input').val('');
}else{
jQuery('.vendor_id_card2').show();
jQuery('.vendor_id_card').hide();
jQuery('.vendor_id_card input').val('');
}
});
if(jQuery('input[name=vendor_register_type]:checked').val() == "บุคคลธรรมดา"){
jQuery('.vendor_id_card').show();
jQuery('.vendor_id_card2').hide();
jQuery('.vendor_id_card2 input').val('');
}else{
jQuery('.vendor_id_card2').show();
jQuery('.vendor_id_card').hide();
jQuery('.vendor_id_card input').val('');
}
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
jQuery('.referal_register input[name="referal_register"]').on('change',function(){
if(jQuery(this).val() == "ไม่มีผู้แนะนำ"){
jQuery('.referal_code input').val('-');
}else{
jQuery('.referal_code input').val(getCookie("referral"));
}
});
if(jQuery('.referal_register input[name="referal_register"]').val() == "ไม่มีผู้แนะนำ"){
jQuery('.referal_code input').val('-');
}else{
jQuery('.referal_code input').val(getCookie("referral"));
}