I have
<script>
//some jQuery code is here to see img1.jpg if hovered on .img1;
//img2.jpg if hovered on .img2;
//img3.jpg if hovered on .img3
</script>
<div id="imgs">
<img src="img1.jpg" alt="">
<img src="img2.jpg" alt="">
<img src="img3.jpg" alt="">
</div>
<ul id="my-ul">
<li><a href="#" class="img1">hover to see image1</a></li>
<li><a href="#" class="img2">hover to see image2</a></li>
<li><a href="#" class="img3">hover to see image3</a></li>
</ul>
I want the corresponding image to appear in the div if hovered and see nothing in a div, if not hovered. How to make it using jQquery?
I'd suggest:
JS Fiddle demo.
You could add an attribute to your hrefs, like
And add some simple Script like
FIDDLE