Support

Account

Home Forums Front-end Issues Conditional logic not working with custom js

Helping

Conditional logic not working with custom js

  • Hello,
    I am using ACF Version 5.10.
    When I created a field(ex: Questions_display_time) and assigned a value to it from jQuery..it is displaying and showing in the form UI also. But the problem is with when I use this value in conditional logic it’s not working. I used js in functions.php file. What could be the reason and how to solve it?
    please do the needful ASAP. I am attaching the ACF form pic also

    This is how iam assigning value in JS (functions.php):

    acf.add_action('ready', function( $el ){
    			const child_created = $('#date_diff').val();
    		//setting value to Questions_display_time
    	$('input[name="acf[field_61237a721a448]"]').attr('value',child_created);
    		});
  • Trigger a change on the field that you are changing so that ACF’s knows that you’ve changed it.

    
    $('selector').trigger('change');
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.