$('*[id]').each(function() {
    const id = $(this).attr('id');
    if (!id) {
      return;
    }