Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
chapmanf16

Conditional Forms on Product Form Popup

Question

Posted (edited)

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!
 

Screen Shot 2020-03-30 at 10.27.47 PM.png

Edited by chapmanf16
More Information

Share this post


Link to post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...