{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {footer_script} (function(){ var targets = { 'input[name="comments_validation"]' : '#email_admin_on_comment_validation', 'input[name="user_can_edit_comment"]' : '#email_admin_on_comment_edition', 'input[name="user_can_delete_comment"]' : '#email_admin_on_comment_deletion' }; for (selector in targets) { var target = targets[selector]; jQuery(target).toggle(jQuery(selector).is(':checked')); (function(target){ jQuery(selector).on('change', function() { jQuery(target).toggle($(this).is(':checked')); }); })(target); }; }()); {/footer_script}