I have a <div>
tag which contains an <ul>
with three <li>
s with an <a>
in each of them.
I have another <div>
tag which contains one default image.
$(document).ready(function() {
$(".vas").click(function() {
$("#banner div").hide();
$("#vas").show();
});
$(".anb").click(function() {
$("#banner div").hide();
$("#anb").show();
});
$(".tam").click(function() {
$("#banner div").hide();
$("#tam").show();
});
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="header">
<img src="../images/nagam1.png">
<ul>
<li><a href="#" class="vas" id="vas" name="vas" onclick="getId(this.id)">Vasantha</a></li>
<li><a href="#" class="anb" id="anb" name="anb" onclick="getId(this.id)">Anbalagan</a></li>
<li><a href="#" class="tam" id="tam" name="tam" onclick="getId(this.id)">Tamilmani</a></li>
</ul>
</div>
<div id="banner">
<img src="../images/family.jpg">
</div>
When clicking every link, how can I make the corresponding image load in <div id="banner">
, i.e. hiding the last image and loading the new corresponding image in it?