We have a product that is customisable, using 5 dropdowns to choose the colours. I'm using the code below to list the chosen colours in the main content section of the product page.
HTML
What I'd like to do is to display the image associated with each option as well, but can't figure out how to pull this and display it. Any help would be massively appreciated!
Cheers, Tom
Code:
<script>
window.addEventListener('load', function() {
document.getElementById('additionv_63').onchange = function() {
var e = document.getElementById("additionv_63");
var text = e.options[e.selectedIndex].text;
document.getElementById("optioncolourone").innerHT ML = 'Colour One: ' + text;
};
document.getElementById('additionv_42').onchange = function() {
var e = document.getElementById("additionv_42");
var text = e.options[e.selectedIndex].text;
document.getElementById("optioncolourtwo").innerHT ML = 'Colour Two: ' + text;
};
});
</script>
HTML Code:
<div id="optioncolourone"></div> <div id="optioncolourtwo"></div> etc
What I'd like to do is to display the image associated with each option as well, but can't figure out how to pull this and display it. Any help would be massively appreciated!
Cheers, Tom