A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.dhtmlx.com/suite/form/api/checkbox/checkbox_getvalue_method/ below:

Website Navigation


JavaScript Form - getValue Checkbox Method

getValue()

returns the current value/state of a Checkbox control

getValue(): string | boolean;

Returns:

Either a string with the current value of the control or a boolean value with the state of the control.

Example

// returns a value if the value is specified for the checkbox
const value = form.getItem("checkbox").getValue(); // -> "checkbox_value"

// returns a state if the value is not specified for the checkbox
const state = form.getItem("checkbox").getValue(); // -> true/false
const form = new dhx.Form("form_container", {
rows: [
{
type: "checkbox",
label: "I agree",
name: "agree",
id: "agree",
checked: true
}
]
});

const state = form.getItem("checkbox").getValue(); // -> true/false
const form = new dhx.Form("form_container", {
rows: [
{
type: "checkbox",
label: "I agree",
name: "agree",
id: "agree",
checked: false,
value: "checkbox_value"
}
]
});

const value = form.getItem("checkbox").getValue(); // -> ""

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4