Hacker News new | past | comments | ask | show | jobs | submit login

Even easier:

  export const hideElementById = (elementId) => {
    document.getElementById(`#${elementId}`).style.display = 'none'
  };
Or perhaps

  export const toggleElementById = (elementId) => {
    const element = document.getElementById(`#${elementId}`);

    const newDisplayValue = element.style.display === 'none' ? 'block' : 'none';

    element.style.display = newDisplayValue;
  };



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: