function bindListeners() {
  document.querySelector('#image-format').addEventListener('change', imgSelect);
  document.querySelector('#image-select').addEventListener('change', imgSelect);

  // Listen for any images that fail to load
  const img = document.querySelector('img');
  img.addEventListener('error', () => {
    const imgSelectMsg = document.querySelector('p.image-msg.select');
    const imgSelectLoad = document.querySelector('p.image-msg.loading');
    const imgSelectSupport = document.querySelector('p.image-msg.no-support');
    img.setAttribute('hidden', '');
    imgSelectMsg.setAttribute('hidden', '');
    imgSelectLoad.setAttribute('hidden', '');
    imgSelectSupport.removeAttribute('hidden');
  });

  // Hide all messages when the image loads
  img.addEventListener('load', () => {
    img.removeAttribute('hidden');
    const imgSelectLoad = document.querySelector('p.image-msg.loading');
    imgSelectLoad.setAttribute('hidden', '');
  });
}
// Bind the event listeners to the dropdown menus and <img> element
Bind the event listeners to the dropdown menus and  element
Bind the event listeners to the dropdown menus and element
function bindListeners() {
  document.querySelector('#image-format').addEventListener('change', imgSelect);
  document.querySelector('#image-select').addEventListener('change', imgSelect);
  const img = document.querySelector('img');
  img.addEventListener('error', () => {
    const imgSelectMsg = document.querySelector('p.image-msg.select');
    const imgSelectLoad = document.querySelector('p.image-msg.loading');
    const imgSelectSupport = document.querySelector('p.image-msg.no-support');
    img.setAttribute('hidden', '');
    imgSelectMsg.setAttribute('hidden', '');
    imgSelectLoad.setAttribute('hidden', '');
    imgSelectSupport.removeAttribute('hidden');
  });
  img.addEventListener('load', () => {
    img.removeAttribute('hidden');
    const imgSelectLoad = document.querySelector('p.image-msg.loading');
    imgSelectLoad.setAttribute('hidden', '');
  });
}
function bindListeners ( ) { document . querySelector ( '#image-format' ) . addEventListener ( 'change' , imgSelect ) ; document . querySelector ( '#image-select' ) . addEventListener ( 'change' , imgSelect ) ; const img = document . querySelector ( 'img' ) ; img . addEventListener ( 'error' , ( ) => { const imgSelectMsg = document . querySelector ( 'p.image-msg.select' ) ; const imgSelectLoad = document . querySelector ( 'p.image-msg.loading' ) ; const imgSelectSupport = document . querySelector ( 'p.image-msg.no-support' ) ; img . setAttribute ( 'hidden' , '' ) ; imgSelectMsg . setAttribute ( 'hidden' , '' ) ; imgSelectLoad . setAttribute ( 'hidden' , '' ) ; imgSelectSupport . removeAttribute ( 'hidden' ) ; } ) ; img . addEventListener ( 'load' , ( ) => { img . removeAttribute ( 'hidden' ) ; const imgSelectLoad = document . querySelector ( 'p.image-msg.loading' ) ; imgSelectLoad . setAttribute ( 'hidden' , '' ) ; } ) ; }
Bind the event listeners to the dropdown menus and <img> element
Bind the event listeners to the dropdown menus and <img > element
// Listen for any images that fail to load // Hide all messages when the image loads