EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

placeholder attribute | placeholder property

Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.

This property is read/write.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10.7.3.12Internet Explorer 10

Syntax

HTML
<element placeholder="sPlaceholder" ... >
JavaScript
object.placeholder = sPlaceholder
sPlaceholder = object.placeholder

Property values

Type: DOMString

A string containing a prompt or hint text that will be displayed in an input field.

Standards information

Remarks

The placeholder attribute can be used on text or text area input controls, or with text-based input attributes URL or email. The following example shows the placeholder text on a URL input field.


<form>
<label>Enter a URL: <input name="url" type="text" placeholder="http://www.contoso.com " /></label>
</form>


See also

HTMLInputElement
HTMLTextAreaElement

 

 

Mostrar:
© 2014 Microsoft. Todos os direitos reservados.