Input Datetime disabled attribute
Definition and usage
disabled
Attribute sets or returns whether the date-time field should be disabled.
Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.
This property reflects the HTML disabled attribute.
See also:
HTML Reference Manual:Propriedade disabled do <input> do HTML
Example
Example 1
Disable the date-time field:
document.getElementById("myDatetime").disabled = true;
Example 2
Check if the date-time field is disabled:
var x = document.getElementById("myDatetime").disabled;
Example 3
Enable and disable the date-time field:
function disableBtn() { document.getElementById("myDatetime").disabled = true; } function undisableBtn() { document.getElementById("myDatetime").disabled = false; }
Syntax
Return the disabled attribute:
datetimeObject.disabled
Set the disabled attribute:
datetimeObject.disabled = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specify whether the date-time field should be disabled.
|
Technical details
Return value: | Boolean value, if the date-time field is disabled, it returns true ,caso contrário, retorna false . |
---|
Suporte do navegador
Os números na tabela indicam a versão do navegador que suporta completamente essa propriedade.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Suporte | 10.0 | Suporte | Suporte | Suporte |
Atenção:O elemento <input type="datetime"> não exibe nenhum campo de data e hora ou calendário em navegadores principais, exceto Safari.