I work in an e-commerce application. In this, I want to complete the task below ...

When I'm in smaller images, I need to show the corresponding images in a large box.
In this, the large image size is 2000 * 2000 pixels and the smaller image size is 80 * 80. But I have large images for the corresponding smaller images in another folder. I want to load a large image into a large box when I find in the corresponding smaller image ...
I did something, but it does not work for me ...
$('img[id^=sm00]').click(function() {
$('#ProductImage').attr('src', $(this).attr('src'));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container col-5">
<img src="assets/bank/cart.png" id="ProductImage" class="img-fluid" data-toggle="modal" data-target="#exampleModalCenter" alt="Responsive image">
</div>
<div class="12">
<div class="row">
<img id="sm001" src="assets/bank/bal1.jpg" alt="img1" class="img-thumbnail">
<img id="sm001" src="assets/bank/bal2.jpg" alt="img1" class="img-thumbnail">
<img id="sm002" src="assets/bank/bal3.jpg" alt="img1" class="img-thumbnail">
<img id="sm003" src="assets/bank/bal4.jpg" alt="img1" class="img-thumbnail">
<img id="sm004" src="assets/bank/bal5.jpg" alt="img1" class="img-thumbnail">
</div>
</div>
Run codeHide result
source
share