tuanphan Posted November 26 Posted November 26 If you want to add a checkbox to Newsletter, users need to check it before clicking submit button. You can follow these. #1. Find ID of Newsletter Block. In my example, it is: #block-yui_3_17_2_1_1732180734113_20813 #2. Use this code to Code Injection Footer (or Page Header Injection) <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { var newsLetterForm = $(".newsletter-form-body")[0]; $(newsLetterForm).find("#block-yui_3_17_2_1_1732180734113_20813 .newsletter-form-fields-wrapper").after('<label><input id="checkbox-form" type="checkbox"> I agree as per privacy policy</label>') var buttonSubmit = $(newsLetterForm).find("button") if($(this).is(':checked')){ buttonSubmit.removeClass("disableButton") } else { buttonSubmit.addClass("disableButton") } $("#checkbox-form").change(function() { if($(this).is(':checked')){ buttonSubmit.removeClass("disableButton") } else { buttonSubmit.addClass("disableButton") } }); }); </script> <style> #block-yui_3_17_2_1_1732180734113_20813 .newsletter-form-button.disableButton { background-color: gray!important; pointer-events: none; } #block-yui_3_17_2_1_1732180734113_20813 div.newsletter-form-body { display: flex; flex-direction: column; } </style> #3. You can change Text/ID here Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment