19. sortable-list/script.js
// Swap list items that are drag and drop
Swap list items that are drag and drop
Swap list items that are drag and drop
function swapItems(fromIndex, toIndex) {
  const itemOne = listItems[fromIndex].querySelector('.draggable');
  const itemTwo = listItems[toIndex].querySelector('.draggable');
  listItems[fromIndex].appendChild(itemTwo);
  listItems[toIndex].appendChild(itemOne);
}
function swapItems ( fromIndex , toIndex ) { const itemOne = listItems [ fromIndex ] . querySelector ( '.draggable' ) ; const itemTwo = listItems [ toIndex ] . querySelector ( '.draggable' ) ; listItems [ fromIndex ] . appendChild ( itemTwo ) ; listItems [ toIndex ] . appendChild ( itemOne ) ; }
Swap list items that are drag and drop
Swap list items that are drag and drop