chapmanf16 Posted March 31, 2020 Share Posted March 31, 2020 Site URL: https://www.americangardenhouse.com/products/o-sweet-viola I'm trying to create an a conditional form (in this case it would be on the additional product form). After selecting the product variants and then clicking "Add to Cart" the popup product form displays with two radio inputs. If "Yes" is selected, I want the additional product form fields to display (currently hidden CSS) and if "No" then an html message to appear prompting the customer to click the product form "Add to Cart" button. <style> #textarea-yui_3_17_2_1_1585523845981_190824, #address-yui_3_17_2_1_1585523845981_456969, #email-yui_3_17_2_1_1585523845981_459960, #phone-yui_3_17_2_1_1585523845981_461162 { display: none; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $('#radio-yui_3_17_2_1_1585593158170_218442 input:radio').click(function() { selection = $(this).val(); if (selection == 'Yes') { $('.form-item').show; } else if (selection == 'No') { $('form').html('Maybe Next Time. Please complete adding this product to your card by clicking "Add to Cart"'); } }); </script> The CSS is loaded using code injector into the page header and the script is in the footer. AJAX is currently disabled. Problem is, the click event is not working. Any help would be greatly appreciated. Thank you! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.