The MailPoet plugin comes with a “subscribe in comments” option that allows visitors who comment on a post to subscribe to your list via a checkbox. But the plugin leaves this box unchecked by default. And it offers no setting/option to have the box checked on page load (some other email plugins like MailChimp have this option but MailPoet doesn’t).
With this jQuery snippet, you can have the box auto-checked on page load:
<script>(function($){ $(document).ready(function(){ $('#mailpoet_subscribe_on_comment').prop('checked', true); }); })(window.jQuery);</script>
You can insert this code on your web pages using a custom code plugin like Head, Footer and Post Injections. Or if your theme comes with it’s own script injection feature, you could use that too.
Since WordPress loads jQuery by default, you don’t need to manually include the jQuery library. It just works.
Cool thing is… The above construct can be used for any checkbox that you want to have checked by default. If you can identify the element ID of the checkbox using your browser’s developer tools, you can then replace #mailpoet_subscribe_on_comment with your checkbox ID and it will stay checked by default on every page load.
For some reason, after I add this and I see it checked, it unchecks itself?