Skip navigation
All Places > Support > Documents
Log in to create and rate content, and to follow, bookmark, and share content with other members.

Adding a Label Above Form Fields

Document created by Jamie Carey on Dec 30, 2014Last modified by Jamie Carey on Jan 20, 2015
Version 3Show Document
  • View in full screen mode

Use sample if you want to place a label above a group of form fields. Here's an example of the result:

 

Note: Please ensure that you have access to an experienced JavaScript developer. Marketo Technical Support is not set up to assist with troubleshooting JavaScript.

In that example, if you wanted to add the label above the "First Name" and "Company Name" fields, you need to first get the IDs of those fields.

 

After you have the ID(s), change the highlighted code below to those IDs. You can then change the style or text in the label by editing the HTML in the "before()" function.

 

<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
  $jQ = jQuery.noConflict();
  $jQ(document).ready(function(){
    $jQ("#FirstName").parent().parent().before("<div style='padding-bottom:20px;font-weight:bold;'>Personal Info</div>");
    $jQ("#Company").parent().parent().before("<div style='padding-bottom:20px;font-weight:bold;'>Company Info</div>");
  });
</script>



 

Download Attachments:

 

Label above form fields-JS.txt

Attachments

    Outcomes