Support

Account

Home Forums Front-end Issues Get True / False field value Javascript

Solved

Get True / False field value Javascript

  • Hey guys,
    Is there any way to get the value of a true / false field in the front end?
    I’m talking about a true / false field in an acf_form. So far I haven’t seen any changes is the dom when you click the box, so how can you get the value of the box?

    Thanks in advance!
    Tim

  • Never mind, I already found the solution! just check the attribute “checked”. If the box is checked it will return the value “checked”. Otherwise the attribute will be undefined.
    So by using this code I check all the boxes within a certain div:

    if (jQuery(this).attr("checked")) {
          // in here it means that the checkbox is checked
    }
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get True / False field value Javascript’ is closed to new replies.