2 Replies Latest reply on Feb 28, 2017 1:37 PM by b5d4614c64851aa2b3ca8a1b98ec3a14b2495768

    jQuery works off and on

      I'm having a weird jQuery issue where the call works sometimes. I'm not loading jQuery since it is baked into form2.js. Here are the details.

       

      Why I'm using it: I'm using it to add a class to form fields and the submit button so that it will respect my CSS.

      <script>
      jQuery( ".mktoButton" ).addClass( "btn btn-primary" );
      jQuery('.mktoField').addClass('form-control');
      </script>
      

       

      Template + Form

      1. I've pasted these two snippets into a Guided landing page template.

      2. Created a landing page and used this template

      3. The form loads initially with the script firing and the input has these classes "mktoField mktoTextField mktoHasWidth mktoRequired form-control"

      4. Refresh the page and the script does not fire. The input loses the class "form-control". Same for the button.