[solved, view working code below] I am trying to change an img src when an Accordion item is selected in elementor. The code I currently have would appear to me as being correct, but it's not working. Probably an obvious fix. It's important not to use JQuery.
my Accordion has 3 "tabs" with an img next to the widget, each tab has an ID #part1 #part2 #part3. And the img has an ID "img_swap".
Javascript code sample for 1 image (now working)
<script>
document.getElementById("part1").onmousedown = function () {
document.getElementById("img_swap").getElementsByTagName("img")[0].src="some_image";
};
</script>
solved
<script>
document.getElementById("part1").onmousedown = function () {
document.getElementById("img_swap").getElementsByTagName("img")[0].src="some_image";
};
</script>