dynamic - Methods - Questions API

Questions API Methods

dynamic

Methods for working with Items that contain dynamic content.

You would want to use this object and its methods to interact with dynamic content and "Try Again" functionality.

Note This object and its dynamic content methods won't appear if there is no dynamic content set for the Item.

Values

Type object

Properties

  • nextAttempt function

    Load the next data row from the dynamic content table in the Item and displays it for the learner.

    Note This method will load the very first dynamic content entry if it has reached the last index.

    // Default behavior (target variation is reset)
    itemsApp.question('my_response_id').dynamic.nextAttempt();
    
    // Preserve the response of the target variation
    itemsApp.question('my_response_id').dynamic.nextAttempt({
        persist_target_response: true
    });
    

    The following arguments are available.

    • options object

      Contains configuration settings that control how the next dynamic Question variation is loaded.

      The following properties are supported.

      • persist_target_response boolean

        Controls whether the learner's response for the dynamic Question variation being navigated to is restored instead of reset.

        Default: false

        Version added: v2026.1.LTS

  • previousAttempt function

    Load the previous data row from the dynamic content table in the Item and displays it for the learner.

    Note This method will load the very last dynamic content entry if it has reached the beginning (index 0).

    // Default behavior (target variation is reset)
    itemsApp.question('my_response_id').dynamic.previousAttempt();
    
    // Preserve the response of the target variation
    itemsApp.question('my_response_id').dynamic.previousAttempt({
        persist_target_response: true
    });
    

    The following arguments are available.

    • options object

      Contains configuration settings that control how the previous dynamic Question variation is loaded.

      The following properties are supported.

      • persist_target_response boolean

        Controls whether the learner's response for the dynamic Question variation being navigated to is restored instead of reset.

        Default: false

        Version added: v2026.1.LTS

  • currentAttemptIndex function

    Returns the index of the current attempt in the dynamic content table.

    itemsApp.question('my_response_id').dynamic.currentAttemptIndex();
    
  • totalAttempts function

    Counts the total number of dynamic content attempts for the current Item.

    Used with the "Try Again" functionality, this is the number of times the learner has clicked "Try Again".

    itemsApp.question('my_response_id').dynamic.totalAttempts();
    
Was this article helpful?

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