Files
freeCodeCamp/mock-guide/english/html/attributes/placeholder-attribute/index.md
Stuart Taylor 7da04a348b fix: Update packages and fix local dev (#26907)
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->

- [x] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md).
- [x] My pull request has a descriptive title (not a vague title like `Update index.md`)
- [x] My pull request targets the `master` branch of freeCodeCamp.
2018-10-23 18:48:46 +05:30

1014 B

title
title
Placeholder Attribute

Placeholder Attribute | HTML5

Specifies a short hint that describes the expected value of an <input> or <textarea> form control.

The placeholder attribute must not contain carriage returns or line-feeds.

NOTE: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take.

Example

Input Example

<form>
    <input type="text" name="fname" placeholder="First Name">
    <input type="text" name="lname" placeholder="Last Name">
</form>

Textarea Example

<textarea placeholder="Describe yourself here..."></textarea>

Compatibility

This is an HTML5 Attribute.

More Information:

HTML placeholder Attribute on w3schools.com