Hello,
I am looking to change an image when I click on a div block. Sounds easy but it gets a bit complicated -
We will call the image that will be changed “PreviewDiv”
The div block that will be clicked is a radio button inside a collection list.
This radio button div block contains an image linked to the collection list’s “Main Image”.
When I click the radio button div block to select the button, I would like to change the image of an outside “PreviewDiv” block to the “Main Image” that is linked to the individual radio buttons within the collection.
I have written some custom code that looks like this.
<script>
var button = document.getElementById('Radio Button Field');
button.onclick = function getImage() {
var image = button.src;
document.getElementById("PreviewDiv") = image;
}
</script>
I don’t get errors when checking the console but I am not able to accomplish this. Any help would be appreciated.
To see what I’m trying to do in action visit the “Heys Template” page
This is the page I am trying to solve the issue on in its published version:
https://model-1-sales.webflow.io/yo/sup
The current code is only in the “Choose a Stock” dropdown, not the other tabs.