subscribe form /challenge#footer-newsletter redirect to another page

Highlighted
New Member
3 0 1

Hi there 

How to redirect subscribe form /challenge#footer-newsletter once it submit go a thank you page

Thanks in advance!

 

0 Likes
Highlighted
New Member
3 0 1

I found the answer redirect add this code in theme.liquid in the bottom just change the ID

 

<script>
      $(document).ready(function(){
        var $returnTo = $('<input type="hidden" name="return_to" value="/pages/thank-you"/>');

        if ($('#footer-newsletter').length > 0){ //if form
          $returnTo.insertBefore($('#footer-newsletter input[type="submit"]')); // add return_to input
        } else if ($('#newsletter-popup').length > 0){ //if form
          $returnTo.insertBefore($('#newsletter-popup input[type="submit"]')); // add return_to input
        } else if ($('#g-recaptcha').length){ //if captcha form
           $returnTo.insertBefore($('.shopify-challenge__container input[type="submit"]'));
        }
      });
	</script> 

 

0 Likes
Highlighted
New Member
2 0 0

Hi, I'm new to this, would like to ask what ID is supposed to be changed in the code? 

0 Likes