CNET JS Code Documentation

Class: OverText

Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.

Author: Aaron Newton

Implements

Syntax

new OverText(inputs[, options]);
 

Arguments

  1. inputs - (array) a collection of DOM elements that should receive the hover text
  2. options - (object, optional) a key/value set of options

Options

Events

  • onTextHide - (function) callback fired when an overtext element is hidden (passed the overtext element and the input element as arguments)
  • onTextShow - (function) callback fired when an overtext element is shown (passed the overtext element and the input element as arguments)

OverText Method: hideTxt

Hides the overtext element for a given input.

Syntax

myOverText.hideTxt(element);
 

Arguments

  1. element - (mixed) A string of the id for an Element or an Element reference whose overtext element should be hidden

Returns

OverText Method: showTxt

Shows the overtext element for a given input.

Syntax

myOverText.showTxt(element);
 

Arguments

  1. element - (mixed) A string of the id for an Element or an Element reference whose overtext element should be shown

Returns

  • (object) - This instance of OverText.

OverText Method: repositionAll

Repositions each overtext element over its appropriate input.

Returns

OverText Method: repositionOverTxt

Repositions the appropriate overtext element over a given input.

Syntax

myOverText.repositionOverTxt(input);
 

Arguments

  1. input - (mixed) A string of the id for an Element or an Element reference whose overtext element should be repositioned

Returns

Native: Element

Extends the native Element object with a reference to its OverText instance.

Element property: overtext

Syntax

myInput.retrieve('overtext'); //the instance of OverText for the element