0
const inputs = Array.from(document.querySelectorAll('input[id]'));

function scheduleMod() {
  $(".wrapper").remove();
  $(".preloader").fadeIn('fast');
  $(".customize").css('display', 'block');
  inputs.forEach(input => {
    const id = input.id;
    const content = localStorage.getItem(id);
    document.getElementById(id).innerHTML = content;
  })
}

function saveCustom() {
  inputs.forEach(input => {
    const id = input.id;
    const text = input.innerText;
    localStorage.setItem(id, text);
  })
  $('.preloader').fadeOut('slow');
}

I used to have this block of code working for tables, but I wanted to replace them with inputs, only to get an error saying Uncaught ReferenceError: Cannot access 'inputs' before initialization. What does it mean? How do I fix it?

Thank you.

Teddy Hwang
  • 131
  • 9

0 Answers0