How to toggle WP Customizer Panel and Section with JavaScript API?

You should not be using jQuery toggle. This is directly manipulating the visibility of DOM elements. Instead, you should be using the active state for the control, section, or panel. You can hide a control via control.active.set(false). You can do the same for a panel or section. See some more examples in my post Dependently-Contextual Customizer Controls. See also my answer at https://wordpress.stackexchange.com/a/286294/8521

To do the same with a panel or section, you’d do:

wp.customize.panel( 'idOfPanel', function( panel ) {
    panel.active.set( false ); // Hide it.
    // ...
} );

wp.customize.section( 'idOfSection', function( section ) {
    section.active.set( true ); // Show it.
    // ...
} );

In the “…” you’d probably want to also override the validate method on the active state to force to have a certain value so that when the Customizer preview refreshes, the active_callback doesn’t override what you set in JS.

tech