AdvancedCustomFields / AdvancedCustomFields/acf
How to get jQuery to recognize a checkbox when a block is added
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I'm having a problem with jQuery trying to hide a checkbox from a block when it's added. For example, I add a block in the editor that has a checkbox selected. I have a jQuery function that if that checbox is selected, all other checkboxes in other blocks should be hidden unless the checkbox in the first block is unselected. The ID of checkbox in the first block is called #cover_photo_set_featured and the checkbox in the block to be added is called #one_image_feature_image.
Here's my jQuery code:
jQuery(document).ready(function ($) {
$(document).on("click", "#cover_photo_set_featured input", function () {
$("#one_image_feature_image label").css("display", "none");
if ($("#cover_photo_set_featured input").is(":checked")) {
$("#one_image_feature_image label").css("display", "none");
} else {
$("#one_image_feature_image label").css("display", "block");
}
});
});
Here's a video of the problem I'm having - https://www.dropbox.com/s/ivfqanxssrh3dtq/acf_logic_blocks.mov?dl=0
Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No project file, test, or implementation entry point is identified; start by reproducing the checkbox behavior in the linked video and tracing how the editor adds blocks. Done would require a confirmed, project-specific fix that correctly updates checkbox visibility for both existing and newly added blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery, php
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100