Skip to main content
  • Community
  • Product Communities
  • Marketo
  • Marketo Knowledge Base
  • Adding a Label Above Form Fields
Jamie-Carey
Jamie-Carey
New Participant
Forum|Forum|11 years ago
December 30, 2014

Adding a Label Above Form Fields

  • Forum|Forum|11 years ago
    December 30, 2014
  • 0 replies
  • 1864 views

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

  • Marketo
Powered by Gainsight
Terms & ConditionsAccessibility statement

Sign up

Already have an account? Login

Login with SSO

Login with oauth

Login to the community

Login with SSO

Login with oauth

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Back to overview

Scanning file for viruses.

Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.

OK

This file cannot be downloaded

Sorry, our virus scanner detected that this file isn't safe to download.

OK

Loading footer...