<img id="my_image" class="icon" src="1.png" alt="1.png" border="0" /> <a onclick="changeImage(this)" href="#" id="1">1</a> <a onclick="changeImage(this)" href="#" id="2">2</a> <a onclick="changeImage(this)" href="#" id="3">3</a> <script> function changeImage(thisDiv){ document.getElementById('my_image').src = thisDiv.id+".png" } </script>
Edit: didn't see jQuery requirements!
source share