Support

Home Forums Event Espresso Premium Add jquery to inline php script to hide questions for certain tickets Reply To: Add jquery to inline php script to hide questions for certain tickets

Reply To: Add jquery to inline php script to hide questions for certain tickets

Author Replies
radiusinvestigations # Posted on May 15, 2018 at 11:23 am

Just realized I think my ‘ and brackets were a bit off:

function ee_custom_hide_question() {
    wp_add_inline_script( 
        'single_page_checkout',
        'jQuery( document ).ready( function( event ){
    function hideQuestion(item, index) {
        jQuery( ".spco-attendee-panel-dv.spco-attendee-ticket-" + item ).
        find( "[id^=\'ee-reg-form-qstn-grp-veterans-pricing-\']" ).hide();
    };
    ["4", "5", "6", "9"].forEach(hideQuestion);,
	
    function requireQuestion(item, index) {
        jQuery( ".spco-attendee-panel-dv.spco-attendee-ticket-" + item ).
        find( "[id^=\'ee-reg-form-qstn-grp-veterans-pricing-\']" ).RemoveAttr("required", false).attr("required", true);
    };
    ["14", "13", "12", "11"].forEach(requireQuestion);
	});'
    );
}
add_action( 'wp_enqueue_scripts', 'ee_custom_hide_question', 11 );

Still didn’t work, but it saved and makes a bit more sense syntax-wise.

Do NOT follow this link or you will be banned from the site!