Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: jQuery event only fires after adding second item to complex group; not on first item #1225

Open
henrik-dons opened this issue Mar 21, 2024 · 0 comments

Comments

@henrik-dons
Copy link

Version

  • Carbon Fields: 3.6.0
  • WordPress: 6.4.3
  • PHP: 8.2

Expected Behavior

jQuery should catch on click event when "cf-complex__inserter-button" button is clicked.

Actual Behavior

Event is only catched when second item is added. Not when first item is added.

Container definition

Post meta container including one complex field and one subfield.

Steps to Reproduce the Problem

Create container and add jQuery on click event handler to the new group click:

$(document).on('click', '.cf-container-post-meta .cf-complex__inserter-button', function () {
console.log('click1');
});

Then you will see that this code only runs when the second item is added to the complex group.
Not on the first item added.

Can this be fixed? Thanks

@henrik-dons henrik-dons changed the title Bug: jQuery event only fires after adding second item in group, not on first item Bug: jQuery event only fires after adding second item to complex group; not on first item Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant