append - Methods - Questions API

Questions API Methods

append()

Appends Questions or Features to the current activity. It expects an Object with Arrays containing the JSON definition for Questions and/or Features.

The corresponding HTML hooks need to be placed in the DOM prior to calling append.

Once the Questions/Features have been rendered, the readyListener is called if defined in Initialization.

Examples

var toAppend = {
    questions: [
        {
            response_id: "toappend",
            type: "shorttext",
            stimulus: "What is the capital of Uruguay?",
            valid_responses: [{
                value: "montevideo",
                score: 1
            }],
            max_length:10
        }
    ],
    responses: {
        "toappend": {
            apiVersion: "latest",
            characterCount: 9,
            revision: 1,
            type: "string",
            value: "montevideo"
        }
    }
};

questionsApp.append(toAppend);

Arguments

  • options object

    • features array

    • questions array

    • responses object

      An optional property responses can be passed inside the parameter object.

      Bear in mind that:

      • It only works in "local_practice" mode.
      • It only works when the activity state is either "resume" or "review".
      • It will make a question "attempted", even without user interaction.

Return value

None (undefined).

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.