# wp-to-buffer/trunk/lib/shared/js/toggle.js

Social Media Auto Poster – Schedule &amp; Publish to Buffer, version trunk. 58 lines.

- Page: https://pluginprobe.com/plugins/wp-to-buffer/trunk/code/lib/shared/js/toggle.js
- Raw: https://pluginprobe.com/plugins/wp-to-buffer/trunk/raw/lib/shared/js/toggle.js
- Modified: 2026-08-19T11:19:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-to-buffer/trunk/code/lib/shared/js/toggle.js#L10-L20`.

```javascript
/**
 * Provides functionality for toggling checkboxes.
 *
 * @package WPZincDashboardWidget
 * @author WP Zinc
 */

/**
 * Toggle checkboxes
 *
 * @since 	1.0.0
 */
jQuery( document ).ready(
	function ( $ ) {

		/**
		 * Toggle Checkboxes with Checkbox
		 */
		$( 'body' ).on(
			'change',
			'input.wpzinc-checkbox-toggle',
			function () {

				var checkboxes = $( 'input.' + $( this ).data( 'target' ) );

				if ( $( this ).is( ':checked' ) ) {
					$( checkboxes ).prop( 'checked', true );
				} else {
					$( checkboxes ).prop( 'checked', false );
				}

			}
		);

		/**
		 * Toggle Checkboxes with Link
		 */
		$( 'body' ).on(
			'click',
			'a.wpzinc-checkbox-toggle',
			function ( e ) {

				e.preventDefault();

				var checkboxes = $( 'input.' + $( this ).data( 'target' ) );

				if ( $( checkboxes ).first().is( ':checked' ) ) {
					$( checkboxes ).prop( 'checked', false );
				} else {
					$( checkboxes ).prop( 'checked', true );
				}

			}
		);

	}
);

```
