Adding alt-text to a dynamic theme | XM Community
Skip to main content

Currently the HTML code for my logo image says the alt text is “logo”. Is there a way to change this to something more specific? I have tried to enter the following code into the footer text box within the theme section but it just adds it to the footer section of the HTML code. 

<script>

document.querySelector(‘#Logo > img’).alt = “Insert Alt Text Here” 

</script>

You can update the code and add to headerbor footer to wait for logo to upload.. 

 

<script>
  document.addEventListener("DOMContentLoaded", function() {
    const logoImg = document.querySelector('#Logo > img');
    if (logoImg) {
      logoImg.alt = "Your Specific Alt Text Here";
    }
  });
</script>
 


Is this the HTML support gave? If so it didn’t work unfortunately for us either. We used JS like the commenter above suggested and that worked for us instead.


Leave a Reply