HTML5 Forms, Part 1 part 2

New Attributes



HTML5 has introduced a new attribute called placeholder. On <input> and <textarea>elements, this attribute provides a hint to the user of what information can be entered into the field.
<form>
<label for="email">Your e-mail address: </label>
<input type="text" name="email" placeholder="email@example.com" />
</form>
Try It Yourself

Result:
The autofocus attribute makes the desired input focus when the form loads:
<form>
<label for="e-mail">Your e-mail address: </label>
<input type="text" name="email" autofocus/>
</form>
Try It Yourself

Result:
The required attribute tells the browser that the input is required.

Comments

Popular posts from this blog

Drag&Drop API