Mar 18, 2021 2:59 pm
The js code from this thread works to check the main comment checkbox, in the way I have it hooked in my code below. How do I check all the reply form checkboxes as well?
https://wpdiscuz.com/community/troubleshooting/checkbox-default/
function my_wpdiscuz_autocheck_agreebox() { ?> <script type="text/javascript"> jQuery('#wpdcom .wpd-field-agreement .wpd-field').prop('checked', true); </script> <?php } add_action('wpdiscuz_comment_form_after', 'my_wpdiscuz_autocheck_agreebox');
2 Replies
Mar 19, 2021 8:46 am
Please replace your code with the following one. It should work fine:
function my_wpdiscuz_autocheck_agreebox() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#wpdcom .wpd-field-agreement .wpd-field').prop('checked', true); }); jQuery(document).ready(function(){ jQuery(document).on('click', '.wpd-reply-button', function() { jQuery('.wpd-form .wpd-field-agreement .wpd-field-group-title .wpd-field').prop('checked', true); }); }); </script> <?php } add_action('wpdiscuz_comment_form_after', 'my_wpdiscuz_autocheck_agreebox');