Home Forums General Issues Show/Hide Divs when ACF checkbox is checked


Show/Hide Divs when ACF checkbox is checked

  • Hi all,

    I’m trying to hide/unhide divs that I’ve added to my user-edit.php file (user profile editor) which has several ACF fields added to it. Among those fields is a checkbox. I am trying to target that textbox so that when it is checked, a div containing content will unhide itself. And if it’s unchecked, the div will then become hidden again.

    I found several javascript methods to hide/unhide divs but they don’t seem to work on the ACF fields. For example, I can create a hard code checkbox with ID=”checkeraoo” and configure my javascript so that when “checkeraoo” is clicked it unhides a div that is on the same page. However, if I configure the javascript to target the ACF checkbox with ID=acf-field-checkaroo, nothing happens.

    If it is safe to assume that my javascript that is coded on the page will not target ACF fields, can someone tell how can I possibly achieve a hide/unhide effect?

    I don’t want to use ACF’s “conditional” feature because some of the items I’ll want to unhide may contain their own javascript.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.