Home Forums General Issues Highlight a checkbox choice in red


Highlight a checkbox choice in red

  • I have a checkbox field called Epipen with the Return Value set to the Value option. The checkbox is located within a repeater and has the following choices:

    • No Epipen
    • Epipen
    • Piriton
    • Cetirizine

    Currently I’m displaying all of the checked choices on the front end using the following code:

    if( have_rows('allergies_and_epipens_list') ):
    while ( have_rows('allergies_and_epipens_list') ) : the_row(); ?>
    <?php the_sub_field('epipen');?>
    <?php endwhile;
    else :
    // no rows found

    When the Epipen choice is selected I’d like it to be highlighted in red when displayed on the frontend.

    Does anyone have any help or advice on how to do this?

  • I figured out a solution. It might not have been the way I was originally thinking but it does the job.

    When editing the field group I added the following code to the Choices text area:

    <span style="color: red;">Epipen</span>

    Now the choice Epipen is highlighted in red in the backend and also highlighted in red on the front end when its checkbox is selected.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.