A text input.
Example
<!--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>
Example
// 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);
});
(require("text-input"))(el) → {HTMLElement}
Parses and initalizes 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
Members
off :module:event-store~off
Removes an event handler from the text input.
Type:
- module:event-store~off
on :module:event-store~on
Registers an event handler on the text input.
Type:
- module:event-store~on
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