trigger(‘change’) not working

I am using wp.media modal attachment API to import images to customizer. Along with the images, I have imported their meta data as well ( Title, Description, Alt Text etc.). These are in the form of input fields in the Customizer. You can check out the Customizer Screenshot here.

Now, I want to the user to be able to make changes and save the attachment details fields using the ‘Publish’ button. Since I am working in a jQuery environment, I am trying to enable the ‘Publish’ Button using the trigger(‘change’) mechanism but I am not able to do it. This is the code for triggering the change event-

jQuery(‘.container input’).on( ‘input’, function() {
jQuery(this).trigger(‘change’);
});

Here, I am binding the trigger event to the change in the input field.

I know on some level that it is wrong but am not able to pinpoint the exact error. Any help will be appreciated.
Also, if this is not the method of saving attachment details in Customizer, any help towards the right direction is welcome.

Read more here:: trigger(‘change’) not working

Leave a Reply

Your email address will not be published. Required fields are marked *