Found 2202 Articles for HTML

HTML DOM Input Color disabled Property

Kumar Varma
Updated on 30-Jul-2019 22:30:26

190 Views

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

HTML DOM Input Color defaultValue Property

Rama Giri
Updated on 30-Jul-2019 22:30:26

157 Views

The HTML DOM Input Color defaultValue property sets/returns the default value corresponding to a color. It may or may not be same as value attribute.SyntaxFollowing is the syntax −Returning string valueinputColorObject.defaultValueSetting defaultValue to stringinputColorObject.defaultValue = ‘string’Boolean ValueHere, “string” can be the following −booleanValueDetails#000000 - #ffffffIt defines that input color can have a default value between the defined rangeExampleLet us see an example of Input Color defaultValue property − Live Demo Input Color Default Value Color Picker: Get Default Value    var divDisplay = document.getElementById("divDisplay");    var inputColor = document.getElementById("Color");    function getDefaultValue() { ... Read More

HTML DOM Input Color autofocus Property

Kumar Varma
Updated on 30-Jul-2019 22:30:26

123 Views

The HTML DOM Input Color autofocus property sets/returns whether Input Color is focused upon initial page load.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputColorObject.autofocusSetting autofocus to booleanValueinputColorObject.autofocus = booleanValueBoolean ValueHere, “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 Color autofocus property − Live Demo Input Color Autofocus Color Picker: Remove Auto Focus    var divDisplay = document.getElementById("divDisplay");    var inputColor = document.getElementById("Color");    divDisplay.textContent = 'Autofocus: '+inputColor.autofocus function removeAutoFocus() {   ... Read More

HTML DOM Input Checkbox value Property

Rama Giri
Updated on 30-Jul-2019 22:30:26

565 Views

The Input Checkbox value property returns a string with the value attribute of input checkbox. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputCheckboxObject.valueSetting value attribute to a string valueinputCheckboxObject.value = ‘String’ExampleLet us see an example of Input Checkbox value property − Live Demo Value Attribute of Checkbox Color-Red: Change value of input checkbox    var valueOfInput = document.getElementById("formCheckbox");    var displayDiv = document.getElementById("displayDiv");    displayDiv.textContent = 'Value: ' + valueOfInput.value;    function changeType(){       if(valueOfInput.value == 'Green' && valueOfInput.checked == true){   ... Read More

HTML DOM Input Checkbox type Property

Kumar Varma
Updated on 30-Jul-2019 22:30:26

145 Views

The Input Checkbox type property returns/sets type of Input Checkbox.SyntaxFollowing is the syntax −Returning string valueinputCheckboxObject.typeSetting type to string valueinputCheckboxObject.type = stringValueString ValuesHere, “stringValue” can be the following -stringValueDetailscheckboxIt defines that input type is checkboxradioIt defines that input type is radiotextIt defines that input type is textExampleLet us see an example of Input Checkbox type property − Live Demo Type Attribute of Checkbox Other: Change type of input    var typeOfInput = document.getElementById("formCheckbox");    var displayDiv = document.getElementById("displayDiv");    displayDiv.textContent = 'Type of Input: ' + typeOfInput.type function changeType(){       ... Read More

HTML DOM Input Checkbox required Property

Rama Giri
Updated on 30-Jul-2019 22:30:26

384 Views

The Input Checkbox required property determines whether Input Checkbox is compulsory to check or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputCheckboxObject.requiredSetting required to booleanValueinputCheckboxObject.required = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that it is compulsory to check the checkbox to submit form.falseIt is the default value and checking is not compulsory.ExampleLet us see an example of Input Checkbox required property − Live Demo Required Attribute of Checkbox Check me ! I am required: Check if form is submittable    function getRequiredStatus(){       var requiredBool ... Read More

HTML DOM Input Checkbox Object

Kumar Varma
Updated on 30-Jul-2019 22:30:26

441 Views

The HTML DOM Input Checkbox Object represents an input HTML element with type checkbox.SyntaxFollowing is the syntax −Creating an with type checkboxvar checkboxObject = document.createElement(“input”); checkboxObject.type = “checkbox”;AttributesHere, “checkboxObject” can have the following attributes −AttributesDescriptionautofocusIt defines if the checkbox should be focused on initial page load.checkedIt defines the state of checkbox i.e. checked/unchecked.defaultCheckedIt returns the default value of checked attribute i.e. true/falsedefaultValueIt sets/returns the default value of checkboxdisabledIt defines if checkbox is disabled/enabledformIt returns a reference of enclosing form that contains the checkboxindeterminateIt sets/returns indeterminate state of checkboxnameIt defines the value of name attribute of a checkboxrequiredIt defines if ... Read More

HTML DOM Input Checkbox name Property

Rama Giri
Updated on 30-Jul-2019 22:30:26

160 Views

The HTML DOM Input Checkbox name property returns a string, which is the value of the name attribute of input checkbox. User can also set it to a new string.SyntaxFollowing is the syntax −Returning string valueinputCheckboxObject.nameSetting name attribute to a string valueinputCheckboxObject.name = ‘String’ExampleLet us see an example of Input Checkbox name property − Live Demo Name Attribute of Checkbox Enable new name: Change Name Attribute    function getFormID(){       var oldNameAttr = document.getElementById("formID");       var newNameAttr = document.getElementById("nameAttr");       if(oldNameAttr.checked == true){     ... Read More

HTML DOM Input Checkbox form Property

Kumar Varma
Updated on 30-Jul-2019 22:30:26

188 Views

The HTML DOM Input Checkbox form property returns the form containing the input checkbox.SyntaxFollowing is the syntax −Returning reference to the form objectinputCheckboxObject.formExampleLet us see an example of HTML DOM Input Checkbox form property − Live Demo Student Details Show Form ID: Get ID of form containing this Checkbox    function getFormID(){       var checkboxFilter = document.getElementById("formID");       var showResultDiv = document.getElementById("showResult");       if(checkboxFilter.checked == true){          showResultDiv.textContent = 'Form ID: ' + checkboxFilter.form.id;       } else {          showResultDiv.textContent = 'Check the checkbox';       }    } OutputThis will produce the following output −Before checking ‘Show Form ID’ checkbox −After checking ‘Show Form ID’ checkbox −

HTML DOM Input Checkbox disabled Property

Rama Giri
Updated on 30-Jul-2019 22:30:26

1K+ Views

The HTML DOM Input Checkbox disabled property sets/returns whether Input Checkbox is to be enabled or disabled.SyntaxFollowing is the syntax −Returning boolean value − true/falseinputCheckboxObject.disabledSetting disabled to booleanValueinputCheckboxObject.disabled = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the checkbox is disabled.falseIt defines that the checkbox is not disabled and it is also the default value.ExampleLet us see an example of Input Checkbox disabled property − Live Demo Student Details Biology: Mathematics: Physics: Psychology: Enable Subjects    function enableCheckboxes(){       var enableCheckboxes ... Read More

Advertisements