Variable API

Variables can be used to present undo/redo capable variables.

.variable(value, [options])

This is a method of the AV object. It creates a variable that can be associated with some UI element. Parameter value is the (initial) value for the variable. Parameter options include the following:

.hide()

Make the variable invisible.

.show()

Make the variable visible.

.value([val])

Set the value of the variable. If the val parameter is left out, this method will return the current value of the variable. The value is converted to the type specified when initializing the variable.

.clear()

Removes the DOM element of this variable from the document. This is useful, for example, in re-initializing exercises when the existing variable needs to be removed.

.addClass(className, [options])

Adds the CSS class className to the variable and animates the changes.

.removeClass(className, [options])

Removes the CSS class className from the variable and animates the changes.

.toggleClass(className, [options])

Toggles the CSS class className of the variable and animates the changes.

.hasClass(className, [options])

Return true/false based on if the variable has the CSS class className.