Assessment/Items

Everything relating to the items in the activity.

Methods

dynamic() → {object}

The dynamic object for the current item. Useful when using dynamic content with try again. https://reference.learnosity.com/items-api/methods/item/dynamic

Since
1.4.0
Returns
Type
(object)

flag()

Toggles the user_flagged state on the current item.

Since
1.4.0

isDynamicItem() → {boolean}

Whether the current item has dynamic content.

Since
1.4.0
Returns
Type
(boolean)

isFirstItem() → {boolean}

Whether the current item is the first item in the activity. This ignores sections, so will be a global check.

Since
0.1.0
Returns
Type
(boolean)

isFlagged() → {boolean}

Whether the current item has been flagged by the user.

Since
0.1.0
Returns
Type
(boolean)

isItemFullyAttempted(reference) → {boolean}

Checks whether the entire item has been fully attempted. Returns false if all possible responses haven't been attempted (eg on cloze types). Handles multi-part items.

Since
0.1.0
Parameters:
Name Type Description
reference string

Optionally pass an exact item reference.

Returns
Type
(boolean)

isLastItem() → {boolean}

Whether the current item is the last item in the activity. This ignores sections, so will be a global check.

Since
0.1.0
Returns
Type
(boolean)

isMaskingEnabled() → {boolean}

Whether the current item has answer masking enabled.

Since
0.4.0
Returns
Type
(boolean)

item(reference) → {object}

JSON object for the current item.

Since
0.1.0
Parameters:
Name Type Description
reference string

Optionally pass an exact item reference.

Returns

An item JSON object.

Type
(object)

itemAttemptStatus() → {string}

Whether the current item has been attempted. Return value can be:

  • not_attempted
  • fully_attempted
  • partially_attempted

Partially attempted items may be where there are 2+ questions on the item and only 1 has been attempted.

Note that if a question accepts multiple responses, eg multiple dropdown elements, this method will return fully_attempted even if not all responses have been attempted. If you want to check all responses have been attempted use isItemFullyAttempted().

Since
0.1.0
Returns
Type
(string)

itemByResponseId(response_id) → {object}

Returns an item object by response id.

Since
1.1.0
Parameters:
Name Type Description
response_id string
Returns

An item JSON object.

Type
(object)

itemElement() → {object}

The current item DOM element.

Since
0.4.0
Returns

HTML DOM element

<div data-reference="[item-reference]" class="learnosity-item lrn-scrollable-container item lrn-assess-item">
  ...
</div>
Type
(object)

itemPosition() → {number}

The current item position, 1-based (not 0-based), in the activity. This ignores sections, so returns the global item position.

Since
0.1.0
Returns
Type
(number)

itemReference() → {string}

The reference of the current item.

Since
0.1.0
Returns
Type
(string)

itemTags() → {array}

All tags that have been set against the current item. Requires retrieve_tags to be set to true in the Items API configuration.

Since
2.9.0
Returns
Type
(array)