Question

lp is not defined lightbox)

  • 19 May 2022
  • 1 reply
  • 24 views

Badge

I see this question has been asked before, but no one has yet answered it that I see.

I have 2 almost identical forms, 1. in a lighbox, and 2. not in a lighbox

I have validation going on that works perfectly well in the 2nd scenario, but not the first:

the lightbox version is giving a console error:  Uncaught ReferenceError: lp is not defined

any ideas?

<script>

lp.jQuery('#full_name').blur(function() {
  var check_name_b = lp.jQuery(this).val().trim().split(" ");
      if(check_name_b.length > 1){
      lp.jQuery(this).css("border-color", "#000000");
      lp.jQuery("#lp-pom-button-3").addClass( "enabled" );
    }
  if(check_name_b.length < 2){
    lp.jQuery(this).css("border-color", "red");
    lp.jQuery("#lp-pom-button-3").removeClass( "enabled" );
      window.alert("Oops, please include:\nFirst Name & Last Name");
    }
});
  

</script>

 


1 reply

Brian! It’s Julie! :-)

Lightboxes don’t look for “lp” - which means landing page.

So you can just kill “lp.” in your jQuery script

 

<script>

jQuery('#full_name').blur(function() {
  var check_name_b = jQuery(this).val().trim().split(" ");
      if(check_name_b.length > 1){
    jQuery(this).css("border-color", "#000000");
      jQuery("#lp-pom-button-3").addClass( "enabled" );
    }
  if(check_name_b.length < 2){
jQuery(this).css("border-color", "red");
jQuery("#lp-pom-button-3").removeClass( "enabled" );
      window.alert("Oops, please include:\nFirst Name & Last Name");
    }
});
  

</script>

Reply