I have a HTML list on a page with several items, each of which contain not just text but also input and tables. I also have a list for order like [3,1,2,0].
Is it possible to reorder the HTML list on the page according to the order list without creating a new list i.e. only the re-ordered list but not the original list shows up on the page?
var ul = document.querySelector('ul'); const order = [3,1,2,0];
<ul> <li>item1</li> <li>item2</li> <li>item3</li> <li>item4</li> </ul>