dr-eric of Spear Code Hub
4/12/2018 - 7:40 PM

left floating Marketo fieldsets

Marketo doesn't allow you to set fieldsets to the right or left of each other. This script uses jQuery to find the two fieldsets that you have in the form and left aligns them.

To use this, you'll need to know the locations of the fieldsets based on the ordering of the Marketo .mktoFormRow's. In the example below, the first fieldset is the first .mktoFormRow on the page, so you select it via the jQuery slice as (0,1), and the next .mktoFormRow on the page that contains the second fieldset is the 7th one on the page, so you use jQuery slice of (6,7). The 7th one is actually '6' as it starts counting at zero (0).

<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/js/forms2/js/forms2.js"></script>
<script type="text/javascript">
  var $jQ = jQuery.noConflict();
  MktoForms2.whenReady(function (form){
    $jQ(".mktoFormRow").slice(0,1).css("float","left");
    $jQ(".mktoFormRow").slice(0,1).css("width","50%");
    $jQ(".mktoFormRow").slice(0,1).css("clear","none");
    $jQ(".mktoFormRow").slice(6,7).css("float","left");
    $jQ(".mktoFormRow").slice(6,7).css("width","50%");
    $jQ(".mktoFormRow").slice(6,7).css("clear","none");
  });
</script>