New Feature: Playlist Center! Pick a topic and let our playlists guide the way—like a learning mixtape.

Start learning with our library of video tutorials taught by experts. Get started

HTML5 First Look
Illustration by

Using placeholder data


From:

HTML5 First Look

with James Williamson

Video: Using placeholder data

One of the nice things about a HTML5 is the focus on usability and improving the user experience. One of the improvements to form usability is the addition of placeholder text to help guide the user through the form requirements. Honestly, it's one of my favorite additions to forms in HTML5. So, let's go ahead and try it out on our own form. So, again, we have the trails.htm file open and this one is open from the 05_03 folder. I am just going to scroll down to find our form and we are going to add some placeholder text to our first three form elements, the trail name, name, and email.
Expand all | Collapse all
  1. 3m 56s
    1. Welcome
      1m 1s
    2. Using the exercise files
      1m 50s
    3. Who is this course for?
      1m 5s
  2. 21m 12s
    1. Exploring prior standards
      4m 26s
    2. Why do we need HTML5?
      3m 32s
    3. HTML5 timeline
      4m 24s
    4. Current HTML5 support
      4m 25s
    5. What HTML5 is (and what it isn't)
      4m 25s
  3. 27m 49s
    1. HTML5 vs. HTML4
      3m 25s
    2. New structural tags
      6m 1s
    3. New content tags
      4m 7s
    4. New application-focused tags
      5m 32s
    5. Deprecated elements
      4m 28s
    6. API overview
      4m 16s
  4. 22m 29s
    1. Content models
      5m 33s
    2. Understanding the outline algorithm
      3m 21s
    3. The role of ‹div› tags
      4m 20s
    4. Using ID and class attributes
      2m 6s
    5. DOCTYPE declarations
      4m 16s
    6. Character encoding
      2m 53s
  5. 41m 27s
    1. Basic page structure
      3m 40s
    2. Structuring top-level elements
      7m 30s
    3. Structuring interior content
      8m 42s
    4. Building headers
      9m 11s
    5. Checking document outlines
      5m 46s
    6. Ensuring cross-browser structure
      6m 38s
  6. 27m 53s
    1. New input types
      5m 57s
    2. Setting form autofocus
      2m 53s
    3. Using placeholder data
      4m 4s
    4. Marking required fields
      3m 24s
    5. Working with number inputs
      5m 49s
    6. Using date pickers
      5m 46s
  7. 1h 1m
    1. Canvas overview
      6m 21s
    2. Adding canvas content
      8m 58s
    3. Drawing in the canvas environment
      12m 9s
    4. Drag-and-drop API overview
      6m 18s
    5. Offline applications overview
      7m 11s
    6. Video overview
      5m 45s
    7. Encoding video
      8m 23s
    8. Adding video
      5m 58s
  8. 57m 33s
    1. Geolocation API overview
      5m 50s
    2. Web storage API overview
      5m 40s
    3. WebSockets overview
      4m 16s
    4. CSS3 overview
      6m 38s
    5. Enhancing typography with CSS3
      7m 42s
    6. Using @font-face
      7m 11s
    7. Styling HTML5 with CSS3
      10m 23s
    8. Using CSS3 transitions
      9m 53s
  9. 5m 6s
    1. Final thoughts
      3m 49s
    2. Goodbye
      1m 17s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
HTML5 First Look
4h 28m Beginner Aug 23, 2010

Viewers: in countries Watching now:

In HTML5 First Look, author James Williamson introduces the newest HTML specification, providing a high-level overview of HTML5 in its current state, how it differs from HTML 4, the current level of support in various browsers and mobile devices, and how the specification might evolve in the future. Exercise files accompany the course.

Topics include:
  • Understanding the history of HTML5
  • Using new tags
  • Understanding HTML5 semantics
  • Coding ID and class attributes in HTML5
  • Structuring documents
  • Building forms
  • Exploring HTML5 native APIs
  • Encoding and adding HTML5 video
  • Exploring associated technologies such as CSS3
Subjects:
Developer Web Web Design Web Development
Software:
HTML
Author:
James Williamson

Using placeholder data

One of the nice things about a HTML5 is the focus on usability and improving the user experience. One of the improvements to form usability is the addition of placeholder text to help guide the user through the form requirements. Honestly, it's one of my favorite additions to forms in HTML5. So, let's go ahead and try it out on our own form. So, again, we have the trails.htm file open and this one is open from the 05_03 folder. I am just going to scroll down to find our form and we are going to add some placeholder text to our first three form elements, the trail name, name, and email.

Now, what placeholder text will do for you is it will place inside of a text field some suggestive text. So, a valid email address is required, first name and last name, you might actually if you are going to do a phone number show them how you want the phone number formatted, those sorts of things. So, it's a nice way of just sort of placing that content in there and the content will be removed as soon as focus on the form field is established. So, what I am going to do is I am going to come down here to our trail name and I am going to take away the autofocus, so that we don't need to worry about autofocus anymore.

Right after the tabindex value, I am going just going to type in placeholder. I am just going to do a placeholder attribute. You can really type any string value you want as long. As the form element is wide enough to display this, your users are going to be able to see this. So, I am going to type in trail name. I am going to go down to the next input type, which is our name input, and I am going to do some placeholder there as well, and the placeholder text here is I am going to type in first and last name. So, again, I am trying to be helpful here and guide them through the process.

And here we are instructing them that we want both their first and last name in the single form field rather than breaking them into separate ones as they might be used to. So, now I am going to go down to the email one and we'll do our last one, and here I am going to say placeholder and inside this I am just going to type in valid email address. So maybe that's something we are going to set through form validation little bit later on and I want to let them know that hey, this is something that we need. We need a valid email address. So, you could also do that. You could use placeholder text to basically go ahead and let the user know which form fields are required.

Okay, so I am going to go ahead and save this, and again I am going to test this in multiple browsers, so that we can see which ones support the placeholder attributes. So, the first one I am going to preview in is Chrome and if I scroll down in Chrome now, you can see that we have trail name, first and last name, and valid email address. As soon as we establish focus in one of the form elements, it goes away. So, you don't have to worry about that text being submitted by the user by mistake. You don't have to worry about the user having to highlight the text and delete it. It's something that's just going to go ahead and be there if there is no content and if focus is not established. But if you type in any content whatsoever or establish focus, the placeholder content goes away.

So, that is really cool. All right, let's try this on a couple of other browsers. Here it is in Safari, and again in Safari we get placeholder data, so we know now it works in Safari. Let's try it in Firefox. So, scrolling down through Firefox. Nope, no placeholder data. Unfortunately Firefox's support of HTML form elements is lagging behind some of the other browsers. Here it is an Opera. If I scroll down in Opera, I notice that Opera doesn't support the placeholder data either. Currently, we are looking at WebKit browsers supporting the placeholder data.

Opera and Firefox are still a little behind on that but I imagine it won't be too long before they support it as well. So the nice thing about the placeholder text from my point view is the value you get out of just a little bit more work and that didn't take us very long. Our form is more engaging to our users when they can see the placeholder data, and it's going to help ensure more accuracy as the form is filled out and that's a really good thing. It's worth pointing out that the placeholder text is displayed using device styling. So, you should test your placeholder text in several devices and browsers to make sure the text has enough room to display properly and it looks acceptable to you, because that is one of the things that you are not going to able to drive through your styles. You are going to have to rely on the device for that.

So that's placeholder text. I am a big fan of it. I think it's going to improve form usability wherever it's used.

There are currently no FAQs about HTML5 First Look.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed HTML5 First Look.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.