function editSli(e) {
  editItemId = e.target.id;
  console.log(editItemId);

  const modal = document.querySelector("[data-js-add-item-form]");
  console.log(modal);
  modal.dataset.jsAddItemForm = "edit";
  console.log(modal.dataset.jsAddItemForm);

  list.forEach((item, index) => {
    if (item.id === editItemId) {
      addItemModal.style.display = "block";

      nliName.value = list[index].name;
      nliType.value = list[index].type;
      nliQty.value = list[index].quantity;
      nliUnits.value = list[index].units;
    } else {
      console.log("nope");
    }
  });

  // addItemModal.style.display = "block";

  // nliName.value = editItemTarget[0].name;
  // nliType.value = editItemTarget[0].type;
  // nliQty.value = editItemTarget[0].quantity;
  // nliUnits.value = editItemTarget[0].units;

  // let editItemTarget = list.filter((list) => list.id === itemId);

  // addItemModal.style.display = "block";

  // nliName.value = editItemTarget[0].name;
  // nliType.value = editItemTarget[0].type;
  // nliQty.value = editItemTarget[0].quantity;
  // nliUnits.value = editItemTarget[0].units;

  nliName.focus();
}
// handle event --> shopping list edit item button

handle event --> shopping list edit item button
handle event -- > shopping list edit item button
function editSli(e) {
  editItemId = e.target.id;
  console.log(editItemId);
  const modal = document.querySelector("[data-js-add-item-form]");
  console.log(modal);
  modal.dataset.jsAddItemForm = "edit";
  console.log(modal.dataset.jsAddItemForm);
  list.forEach((item, index) => {
    if (item.id === editItemId) {
      addItemModal.style.display = "block";
      nliName.value = list[index].name;
      nliType.value = list[index].type;
      nliQty.value = list[index].quantity;
      nliUnits.value = list[index].units;
    } else {
      console.log("nope");
    }
  });
  nliName.focus();
}
function editSli ( e ) { editItemId = e . target . id ; console . log ( editItemId ) ; const modal = document . querySelector ( "[data-js-add-item-form]" ) ; console . log ( modal ) ; modal . dataset . jsAddItemForm = "edit" ; console . log ( modal . dataset . jsAddItemForm ) ; list . forEach ( ( item , index ) => { if ( item . id === editItemId ) { addItemModal . style . display = "block" ; nliName . value = list [ index ] . name ; nliType . value = list [ index ] . type ; nliQty . value = list [ index ] . quantity ; nliUnits . value = list [ index ] . units ; } else { console . log ( "nope" ) ; } } ) ; nliName . focus ( ) ; }
handle event --> shopping list edit item button
handle event -- > shopping list edit item button
// addItemModal.style.display = "block";
 // nliName.value = editItemTarget[0].name;
 // nliType.value = editItemTarget[0].type;
 // nliQty.value = editItemTarget[0].quantity;
 // nliUnits.value = editItemTarget[0].units;
 // let editItemTarget = list.filter((list) => list.id === itemId);
 // addItemModal.style.display = "block";
 // nliName.value = editItemTarget[0].name;
 // nliType.value = editItemTarget[0].type;
 // nliQty.value = editItemTarget[0].quantity;
 // nliUnits.value = editItemTarget[0].units;
