Class: Choice

nyc/Choice~ Choice


new Choice(options)

Create an instance of Choice

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

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:
Overrides:
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:
Overrides:
Source:
Returns:

The element

Type
jQuery

getContainer()

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

Inherited From:
Overrides:
Source:
Returns:

The the control container HTML element wrapped in a JQuery

Type
jQuery

off(eventName, evtHdlr [, hdlrScope])

Remove a previously connected event handler

Parameters:
Name Type Argument Description
eventName string

The name of the event to which the handler will be connected

evtHdlr function

The event handler function

hdlrScope Object <optional>

The scope in which to invoke the event handler

Inherited From:
Overrides:
Source:

on(eventName, evtHdlr [, hdlrScope])

Connect a function to an event

Parameters:
Name Type Argument Description
eventName string

The name of the event to which the handler will be connected

evtHdlr function

The event handler function

hdlrScope Object <optional>

The scope in which to invoke the event handler

Inherited From:
Overrides:
Source:

one(eventName, evtHdlr [, hdlrScope])

Connect a function to an event for a single invocation

Parameters:
Name Type Argument Description
eventName string

The name of the event to which the handler will be connected

evtHdlr function

The event handler function

hdlrScope Object <optional>

The scope in which to invoke the event handler

Inherited From:
Overrides:
Source:

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:
Overrides:
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:

trigger(eventName [, data])

Trigger a named event with event data

Parameters:
Name Type Argument Description
eventName string

The name of the event to trigger

data Object <optional>

The event data

Inherited From:
Overrides:
Source:

val(choices)

Get or set the seleced choices

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

The choices

Source:
Returns:

Chosen options

Type
Array

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: