Is it possible to activate customfield ‘text description’ upon activating the customfield ‘checkbox’?

I’m trying to find a solution how to activate a another customfield in WordPress pages when the selectbox is selected.

This is the script to simply show the customfield 'checkbox' in wordpress page editor.

Read More
array(
    'name' => 'Lees meer button',
    'desc' => 'Leesbutton weergeven.',
    'id'   => $prefix . 'homepage_slider_leesmeer',
    'type' => 'checkbox',
),

What I want to achieve is to display a another customfield in the WordPress page editor, when the selectbox is checked.

How can this be done?

Related posts

Leave a Reply

1 comment

  1. A possible solution is to use jquery to show/hide your custom field, something like this:

    <script>
        jQuery(document).ready(function($) {
        $('#yourcheckboxidentifier').click(function() {
            $('#customfieldidentifier').fadeToggle(400);
        });
        if ($('#yourcheckboxidentifier').val() !== undefined) {
            $('#customfieldidentifier').show();
        }
    });
    </script>