Change image source via button click

Description

var imageContainer = document.getElementById(“Unique-ID”); is the parent of the image augmentation. An example for the Unique-ID would be 9288241c-aa13-4062-b701-1a6675e6b6d3.

To change the src of the image you have to access the child element of the augmentation.

<div id="parent-div" style="width: 200px; height: 100px;">
<button id="button" style="width: 100%; height: 100%;" type="button">Change image</button>
</div>

var btn = document.getElementById('button');
btn.addEventListener("touchstart",
function(){
var imageContainer = document.getElementById("9288241c-aa13-4062-b701-1a6675e6b6d3");
var image = imageContainer.children[0];
image.src = "url of your image";
});

Close Menu
Close Panel