Skip to content

Commit

Permalink
Brevo toggle box
Browse files Browse the repository at this point in the history
takayukister committed Sep 9, 2024
1 parent 4a88b20 commit b4510e8
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion admin/includes/js/index.js
13 changes: 13 additions & 0 deletions admin/includes/js/src/index.js
Original file line number Diff line number Diff line change
@@ -50,4 +50,17 @@ document.addEventListener( 'DOMContentLoaded', event => {
} );
}
} );

document.querySelectorAll(
'#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email'
).forEach( checkbox => {
checkbox.addEventListener( 'change', event => {
if ( checkbox.checked ) {
checkbox.closest( 'tr' ).classList.remove( 'inactive' );
} else {
checkbox.closest( 'tr' ).classList.add( 'inactive' );
}
} );
} );

} );
8 changes: 1 addition & 7 deletions admin/js/scripts.js
Original file line number Diff line number Diff line change
@@ -7,12 +7,6 @@
}

$( function() {
$( '#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( this ).closest( 'tr' ).removeClass( 'inactive' );
} else {
$( this ).closest( 'tr' ).addClass( 'inactive' );
}
} );

} );
} )( jQuery );

0 comments on commit b4510e8

Please sign in to comment.