Found 2417 Articles for HTML

HTML DOM Input Datetime Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

145 Views

The HTML DOM Input Datetime Object represents an input HTML element with type datetime. Also, major browsers, except safari take type datetime as text only.SyntaxFollowing is the syntax −Creating an with type datetimevar datetimeObject = document.createElement(“input”); datetimeObject.type = “datetime”;AttributesHere, “datetimeObject” can have the following attributes −AttributesDescriptionautocompleteIt defines the value of autocomplete attribute of a datetime fieldautofocusIt defines if the datetime field should be focused on initial page load.defaultValueIt sets/returns the default value of datetime fielddisabledIt defines if datetime field is disabled/enabledformIt returns/sets the value of max attribute of datetime fieldminIt returns/sets the value of min attribute of datetime fieldnameIt ... Read More

HTML DOM Input Datetime name Property

AmitDiwan
Updated on 15-Jun-2020 12:15:23

54 Views

The HTML DOM Input Datetime name property returns a string, which is the value of the name attribute of input datetime. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputDatetimeObject.nameSetting name attribute to a string valueinputDatetimeObject.name = ‘String’ExampleLet us see an example of Input Datetime name property − Live Demo Input Datetime Name Datetime: Change name value    var inputDatetime = document.getElementById("datetime");    var divDisplay = document.getElementById("divDisplay");    divDisplay.textContent = 'Name of datetime input: '+inputDatetime.name;    function changeNameValue() {       if(inputDatetime.name == "Mother's Birth ... Read More

HTML DOM Input Datetime min Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

81 Views

The HTML DOM Input Datetime min property returns/sets min attribute of Input Datetime.SyntaxFollowing is the syntax −Returning string valueinputDatetimeObject.minSet min to string valueinputDatetimeObject.min = YYYY-MM-DDThh:mm:ssTZDString ValuesHere, “YYYY-MM-DDThh:mm:ssTZD” can be the following −stringValueDetailsYYYYIt defines year (eg:1998)MMIt defines month (eg: 05 for May)DDIt defines Day (eg: 24)TIt is a separator for date and timehhIt defines hour (eg:12)mmIt defines minutes (eg:48)ssIt defines seconds (eg:00)TZDTime Zone Designator (IST denotes Indian Standard Time)ExampleLet us see an example of Input Datetime min property − Live Demo Input Datetime Min Date & Time: Decrease min age bar    var ... Read More

HTML DOM Input Datetime max Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

103 Views

The HTML DOM Input Datetime max property returns/sets max attribute of Input Datetime.SyntaxFollowing is the syntax −Returning string valueinputDatetimeObject.maxSetting max to string valueinputDatetimeObject.max = YYYY-MM-DDThh:mm:ssTZDString ValuesHere, “YYYY-MM-DDThh:mm:ssTZD” can be the following −stringValueDetailsYYYYIt defines year (eg:1998)MMIt defines month (eg: 05 for May)DDIt defines Day (eg: 24)TIt is a separator for date and timehhIt defines hour (eg:12)mmIt defines minutes (eg:48)ssIt defines seconds (eg:00)TZDTime Zone Designator (IST denotes Indian Standard Time)ExampleLet us see an example of Input Datetime max property − Live Demo Input Datetime Max Date & Time: Renew Insurance    var inputDate = document.getElementById("dateTime"); ... Read More

HTML DOM Input Datetime form Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

81 Views

The HTML DOM Input Datetime form property returns the reference of enclosing form for input datetime.SyntaxFollowing is the syntax −Returning reference to the form objectinputDatetimeObject.formExampleLet us see an example of Input Datetime form property − Live Demo Input Datetime form Date & Time: Get Form ID    function getFormID() {       var inputDatetime = document.getElementById("Datetime");       var divDisplay = document.getElementById("divDisplay");       divDisplay.textContent = 'Form ID for datetime input: '+inputDatetime.form.id;    } OutputThis will produce the following output −Before clicking ‘Get Form ID’ button −After checking ‘Get Form ID’ button −

HTML DOM Input Datetime disabled Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

94 Views

The HTML DOM Input Datetime disabled property sets/returns whether Input Datetime is enabled or disabled.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDatetimeObject.disabledSetting disabled to booleanValueinputDatetimeObject.disabled = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the input datetime is disabled.falseIt defines that the input datetime is not disabled and it is also the default value.ExampleLet us see an example of Input Datetime disabled property − Live Demo Input Datetime Disabled Date & Time: Enable Datetime Input    var divDisplay = document.getElementById("divDisplay");    var inputDatetime = document.getElementById("datetimeSelect");    divDisplay.textContent = 'Datetime Input ... Read More

HTML DOM Input Datetime autofocus Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

87 Views

The HTML DOM Input Datetime autofocus property sets/returns whether Input Datetime is focused upon initial page load.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDatetimeObject.autofocusSetting autofocus to booleanValueinputDatetimeObject.autofocus = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that input will be autofocused on page load.falseIt is the default value and input is not autofocused.ExampleLet us see an example of Input Datetime autofocus property − Live Demo Input Datetime Autofocus Date & Time: Remove Auto Focus    var divDisplay = document.getElementById("divDisplay");    var inputDatetime = document.getElementById("Datetime");    divDisplay.textContent = 'Autofocus: '+inputDatetime.autofocus function removeAutoFocus() { ... Read More

HTML DOM Input Date value Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

81 Views

The HTML DOM Input Date value property returns a string, which is the value of the value attribute of input date. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputDateObject.valueSetting value attribute to a string valueinputDateObject.value = ‘String’ExampleLet us see an example of Input Date value property − Live Demo Input Date Value Calendar: Change Value    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    divDisplay.textContent = 'Current value: '+ inputDate.value;    function changeValue(){       var currDate = inputDate.value;       ... Read More

HTML DOM Input Date type Property

AmitDiwan
Updated on 15-Jun-2020 12:07:02

69 Views

The HTML DOM Input Date type property returns/sets type of Input Date.SyntaxFollowing is the syntax −Returning string valueinputDateObject.typeSetting type to string valueinputDateObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsdateIt defines that input type is dateradioIt defines that input type is radiocheckboxIt defines that input type is checkboxExampleLet us see an example of Input Date type property − Live Demo Input Date type Calendar: Change Type    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    divDisplay.textContent = 'Input type: '+ inputDate.type;    function changeType(){       ... Read More

HTML DOM Input Date stepUp() Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

56 Views

The HTML DOM Input Date stepUp() method defines the amount of days the date field should increase.SyntaxFollowing is the syntax −Calling stepUp method with a number, which by default is equal to 1inputDateObject.stepUp(number)ExampleLet us see an example of Input Date stepUp method − Live Demo Input Date stepUp() Calendar: Increase by 2 Increase by 3    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    function changeStep(num){       if(num===2)          inputDate.stepUp(2);       else          inputDate.stepUp(3);       divDisplay.textContent = 'Current date increased by: '+num;    } OutputThis will produce the following output −Clicking ‘Increase by 2’ button −Clicking ‘Increase by 3’ button −

Advertisements