widget.changed - Events - Question Editor API

Question Editor API Events

widget:changed

Fires when the author selects a new Question or Feature type. This also fires when the setWidget() method is called.

You would want to be notified about this event firing, because you might want to take some action when the author has selected a new Question or Feature type.

Note It is not fired when an attribute within the widget changes, use widgetedit:preview:changed instead.

The on() or once() methods can be used to listen to this event.

Examples

// Run each time the event is fired
authorApp.on('widgetedit:widget:changed', function () {
    console.log('This code executes when a new Question or Feature is selected.');
});

// Run only once, the first time the event is fired
authorApp.once('widgetedit:widget:changed', function () {
    console.log('This code executes only once, when a new Question or Feature is selected.');
});

Related articles

Was this article helpful?

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