Can't display hosted images in AMP site

173 Views Asked by At

I'm creating a basic AMP site, after the XMLHttpRequest that loads the product details I change the web content using javascript:

document.getElementById("stock").innerHTML = result.ref

This is the right approach for this new framework?

But what about the images? It recognises only the <amp-img> ID tag, not it child (standard <img>).

I've tried this way with no success:

document.getElementById("stock").src = "PATH_TO_MY_SITE" + result.ref + ".png"

It shows this error: Either non-empty "srcset" or "src" attribute must be specified:

0

There are 0 best solutions below