Class: Choice

nyc/Choice~ Choice


new Choice(options)

Class for creating checkbox and radio input widgets

Parameters:
Name Type Description
options module:nyc/Choice~Choice.Options
Source:
Fires:

Extends

Methods


append(elements)

A method to append elements to the container

Parameters:
Name Type Description
elements jQuery | Element | Array.<Element> | string

The element to append

Inherited From:
Source:
Returns:

The container

Type
jQuery

find(selector)

A method to return elements in the container

Parameters:
Name Type Description
selector string

jQuery selector

Inherited From:
Source:
Returns:

The element

Type
jQuery

getContainer()

A method to return a control container HTML element wrapped in a JQuery

Inherited From:
Source:
Returns:

The the control container HTML element wrapped in a JQuery

Type
jQuery

prepend(elements)

A method to prepend elements to the container

Parameters:
Name Type Description
elements jQuery | Element | Array.<Element> | string

The element to append

Inherited From:
Source:
Returns:

The container

Type
jQuery

setChoices(choices)

Set the available choices

Parameters:
Name Type Description
choices Array.<module:nyc/Choice~Choice.Choice>

The choices

Source:

val(choices)

Get or set the seleced choices

Parameters:
Name Type Description
choices Array.<module:nyc/Choice~Choice.Choice>

The choices

Source:

Type Definitions


Choice

Type:
  • Object
Properties:
Name Type Argument Default Description
name string

The name for the choice

label string

The label for the choice

value Array.<Object>

The value of the choice

checked boolean <optional>
false

The value of the checked state of the choice

Source:

Options

Constructor options for module:nyc/Choice~Choice

Type:
  • Object
Properties:
Name Type Argument Default Description
target jQuery | Element | string

The target DOM node for creating the choice control

choices Array.<module:nyc/Choice~Choice.Choice>

The choices

radio boolean <optional>
false

Checkbox or radio button

Source:

Events


change

The change event

Type: module:nyc/Choice~Choice
Source: