Moving the labels on a contact form to inside the fields is as easy as replacing the word “Label” with the word “Placeholder.” Really. We’ll use a simple Jetpack contact form as our example, but it’s basically the same procedure for MailChimp sign up forms or any other forms you can access the HTML or shortcodes for.

Technically, we’re not moving the labels, we are replacing them with placeholders (which is even easier!).  A label is out side the form, a placeholder is inside.

How to move name and email from outside a form to inside it:

  1. Place your contact form by clicking the “Add Contact Form” button.  If you need to change the fields on the form, do that by clicking on the contact form that was added, and then selecting the little pencil icon to edit it.  Once you have it how you’d like it, click “Update form” at the bottom.
  2. Now we’re going to hop over to the “Text” (HTML) view of your post or page so we can see the shortcode or HTML.  (In Jetpack’s case, it is shortcode.)
  3. Find the fields you want to change.
    They will look like label="Name"
  4. Highlight label for each one, and replace it with the word placeholder.
    They will now look like placeholder="Name"
  5. Save your work, you’re done!

Here’s a side-by-side of the Jetpack form before-and-after:

Labels:

[contact-form][contact-field label=”Name” type=”name”][contact-field label=”Email” type=”email”][contact-field label=”Website” type=”url”][contact-field label=”How can I help you?” type=”textarea”][/contact-form]

Placeholders:

[contact-form][contact-field placeholder=”Name” type=”name”][contact-field placeholder=”Email” type=”email”][contact-field placeholder=”Website” type=”url”][contact-field placeholder=”How can I help you?” type=”textarea”][/contact-form]


And here’s a video if you would rather watch instead of read:

YouTube video

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

3 Comments

  1. Hey,
    For accessibility purposes – the placeholder is not recognized as label, is there any way to put inside the text field “aria-label”?

    1. Great point! I should update this old post. šŸ™‚

      You can just replace:
      label=”Name” with aria-label=”Name”

      OR, you can hide it visually, but not from screen readers by adding this CSS:

      label {
      border: 0;
      clip: rect(0 0 0 0);
      height: 1px;
      margin: -1px;
      overflow: hidden;
      padding: 0;
      position: absolute;
      width: 1px;
      }

      Just make sure you get specific about WHICH label you’re hiding in the CSS (e.g. .contact-form label {…}) or you’ll hide all of them on your site.

  2. What does the phrase ā€œas easy as replacing the word ā€˜Labelā€™ with the word ā€˜Placeholderā€™ā€ suggest about the difficulty level of this change? Greeting : IT Telkom