3 Replies Latest reply on Jul 31, 2014 9:38 AM by 63584

    modifying form html

           Is there a way to actually modify the html of the forms that are created?  For example lets say I wanted to add an Id or change the class name or add a new attribute altogether.

           Thanks,
            

           Dan

        • Re: modifying form html
          Dory Viscogliosi
          Hi Dan, I believe that you can do this on the page where your form resides. It isn't done directly in the form.
          • Re: modifying form html
            Kenny Elkington
            Hey Daniel,

            You cannot do this from directly within the form editor, but you can do this with the addition of some custom code.  Since Forms 2 loads asynchronously you'll need to use the whenReady event to make sure that the code executes correctly:

            <script>
            MktoForms2.whenReady(function(form){
            $('#yourId').addClass('myClass myOtherClass'); //add a class
            $('#yourId').attr('yourAttribute', 'yourValue'); //add an attribute with a value
            });
            </script>

            Keep in mind that you can only have a single id per element, so overwriting this is not a good id, and can break form functionality.
            • Re: modifying form html

                   Thanks for that!  That worked.

                   Dan