Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Resetting a list in a modal


I am having trouble resetting a list in my modal. When I open the modal again, the list still contains items from the previous order and only the first input box is cleared. This seems to be a bug and I have reported it to the team by creating a GitHub issue.


The solution to clear/reset the list when opening the modal is to remove all the elements from the list using JavaScript before adding any new ones. This can be done by selecting the list element using its ID and calling the innerHTML property with an empty string to remove all the child nodes.

Here's an example code snippet:

const list = document.getElementById('list');
list.innerHTML = '';

This code will select the HTML element with the ID 'list', which represents the list container, and set its innerHTML property to an empty string. This will remove all the child nodes of the list container, including the list items from the previous order.

After clearing the list, you can add new list items to it by appending new child nodes using JavaScript, as you did before. This will ensure that the list is always reset when opening the modal.