PrizmDoc v12.4 - Updated
Module: text-input

Module: text-input

A text input.

(require("text-input"))(el) → {HTMLElement}

Parses and initializes a text input.

Parameters:
Name Type Description
el HTMLElement

The parent element in which to parse for the text input component.

Returns:

The parsed text input element.

Type
HTMLElement
Examples
<!--The following HTML includes a text input component.
An element is specified as a text input by setting the data-pcc-component attribute
to "textinput".-->
<div data-pcc-component="textinput" data-pcc-name="displayName" class="pcc-textbox"></div>
// Require the text input module.
var TextInput = require('../elements/text-input.js');

// Pass each text input element to the text input module to initialize each text input.
// parent is the element that contains the text input element.
$(parent).find('[data-pcc-component="textinput"]').each(function() {
    TextInput(this);
});

Members

off :module:event-store~off

Removes an event handler from the text input.

Type:

on :module:event-store~on

Registers an event handler on the text input.

Type:

Methods

destroy()

Destroys the text input component.

focus()

Focuses the text input component

hideError() → {HTMLElement}

Removes the text below the text input if showError was called previously to show text below the text input.

Returns:

The text input element.

Type
HTMLElement

showError(error) → {HTMLElement}

Shows the specified text below the text input.

Parameters:
Name Type Description
error string

The error text to show below the text input.

Returns:

The text input element.

Type
HTMLElement

value(text) → {Object}

Gets or sets the value of the text input.

Parameters:
Name Type Description
text string

The text to show in the text input.

Returns:

The text input element if a value is passed. Otherwise, the current value is returned.

Type
Object