JobsDB HK Employer
} else{
$(‘#other-industry-form-group’).remove();
}
});
$(‘.modal-form’).parsley({
successClass: ‘has-success’,
errorClass: ‘has-error’,
classHandler : function( _el ){
return _el.$element.closest(‘.form-group’);
}
});
$(‘#inquiryForm textarea’).autoResize();
var CountryCode = ‘hk’;
var FeedbackURL = ‘/en-hk/cms/employer/wp-content/themes/jobsdb/template-parts/form/feedback-hk.php’;
$(‘#id_country_id’).on(‘change’, function(e){
var CountryCode = e.target.value;
if( CountryCode !== ‘hk’ ){
$(‘#id_state_id’).val(‘OT’);
} else {
$(‘#id_state_id’).val(’00’);
}
});
$(“#enquiry_type_code”).change(function(e){
var InquiryCode = e.target.value;
console.log(InquiryCode);
if ( InquiryCode == ‘6’ ) {
$(“#inquiryModal #row-hidden-pricing”).addClass(‘show’).removeClass(‘hide’);
} else {
$(“#inquiryModal #row-hidden-pricing”).addClass(‘hide’).removeClass(‘show’);
}
if ( InquiryCode == ‘8’ || InquiryCode == ‘9’ || InquiryCode == ‘0’ ) {
$(“#inquiryModal #row-visible, #inquiryModal .btn-block, #inquiryModal .visit-area”).addClass(‘hide’).removeClass(‘show’);
$(“#inquiryModal #row-hidden, #inquiryModal .question-area”).addClass(‘show’).removeClass(‘hide’);
} else {
$(“#inquiryModal #row-visible, #inquiryModal .btn-block, #inquiryModal .visit-area”).addClass(‘show’).removeClass(‘hide’);
$(“#inquiryModal #row-hidden, #inquiryModal .question-area”).addClass(‘hide’).removeClass(‘show’);
}
});
$(‘#inquiryForm’).submit(function(evt) {
var response = grecaptcha.getResponse();
if(response.length == 0){
$(“.recaptcha_error”).text(“Please verify you are human!”);
evt.preventDefault();
return false;
}else{
var formData = new FormData($(“#inquiryForm”)[0]);
var enquiryType = $(‘select#enquiry_type_code :selected’).text();
var trim_enquiry_Type = enquiryType.replace(/ /g,”);
$.ajax({
type: “POST”,
data: formData,
url: FeedbackURL,
processData: false,
contentType: false,
success: function (response) {
$(‘#inquiryModal .dialog-success’).removeClass(‘hide’);
$(‘#inquiryModal .dialog-inquiry’).addClass(‘hide’);
$(‘#inquiryModal’).on(‘hidden.bs.modal’, function (e) {
$(this).find(‘#inquiryForm’).trigger(‘reset’).find(‘.form-group’).removeClass(‘has-success’);
$(‘#inquiryModal .dialog-inquiry’).removeClass(‘hide’);
$(‘#inquiryModal .dialog-success’).addClass(‘hide’);
});
s.tl(this,’o’,’CMS:Employers:NatureofInquiry:’+trim_enquiry_Type+”);
s.tl(true,’o’,’CMS:Employers:InquirySubmitSuccess’);
var scriptInquirySubmitHK = document.createElement(‘script’);
scriptInquirySubmitHK.type = ‘JavaScript1.1’;
scriptInquirySubmitHK.src = “//pixel.mathtag.com/event/js?mt_id=1310107&mt_adid=206552&mt_exem=&mt_excl=”;
scriptInquirySubmitHK.async = true;
$(scriptInquirySubmitHK).appendTo( ‘head’ );
if ( $(‘#other-industry-form-group’).length > 0 ) {
$(‘#other-industry-form-group’).remove();
}
dataLayer.push({
‘event’: ‘gtm.inquiry’,
‘eventAction’: ‘submit_success’,
‘eventLabel’: trim_enquiry_Type
});
}
});
return false;
}
});
$(‘#inquiryModal’).on(‘hidden.bs.modal’, function (e) {
$(‘select#id_industry_id’).prop(‘selectedIndex’, 0);
if ( $(‘#other-industry-form-group’).length > 0 ) {
$(‘#other-industry-form-group’).remove();
}
});
});
})(jQuery);