0

I am adding custom jQuery to display certain fields on the basis of conditional logic. For eg: When a "Business Type" field value is selected as Company, "Company Name" and "Company Website" fields are displayed. Otherwise, these fields are hidden.

enter image description here

Everything works fine until the gravity forms default validation messages are displayed. When the validation error messages are present, #input_2_8 change event doesn't get fired. Please, can anyone help me with this?

enter image description here

To display/hide Company fields depending on Business type value

jQuery(document).ready(function($){
    //Hide the fields by default
    $('#input_2_9').css('display','none');
    $('#input_2_10').css('display','none');
    $('#input_2_8').on('change', function(e){
    var self = $(this);
    if(self.val() === 'Business') {
        $('#input_2_9').fadeIn();
        $('#input_2_10').fadeIn();
    }else{
        $('#input_2_9').fadeOut();
        $('#input_2_10').fadeOut();
        }
   });

});

If anyone wants to have a look at the form then here is the url: https://gems-precious.com/form/

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.