WhatsApp us

Clickable row only works on the first page of pagination in datatables

  • Tech Area
  • Last updated on: January 8, 2026


I have a page that displays records in bootstrap datatables. The records are displayed 10 rows per page and each row has image on the one column. What I want to do is, when I clicks on the image, it will show in bigger size or zoom. I already implemented this but unfortunately it only works on the first page of pagination. When I go to second page and click on the table row, the image is not clickable.

Solution

<td> <a href="javaScript:void(0);" data-image-path="data:image/gif;base64,<?php echo  $data; ?>" class="showImagePop"><?php echo '<div class="ImagePop"><img src="data:image/gif;base64,' . $data . '" width="100" height="100" /></div>'; ?></a></td>

<div class="show">
      <div class="overlay"></div>
      <div class="img-show">
      <img src="">
      </div>
</div>

<script type="text/javascript">
    $(function () {
        
        $("#dataTable").on("click", ".showImagePop", function () {
            var $src = $(this).data("image-path");
            $(".show").fadeIn();
            $(".img-show img").attr("src", $src);
            });

        $("span, .overlay").click(function () {
            $(".show").fadeOut();
        });

    });
</script>


Subscribe us via Email

Join 20,000+ subscriber

Subscribe on YouTube

PHP Projects
Matrimonial Portal Project in PHP & MySQL Last Updated: December 22, 2025
Event Management System Project in PHP & MySQL Last Updated: December 6, 2025
Online Shopping System Project in PHP MySQL Last Updated: November 26, 2025
Hostel management system project in PHP and MySQL Last Updated: February 14, 2024
Online Pizza Delivery project in PHP Last Updated: February 4, 2024
Parking Management System project in PHP Last Updated: November 5, 2023
Visitors Management System project in PHP Last Updated: August 28, 2023
SNIPE – IT Asset management system v6.1.0 Last Updated: April 21, 2023
Employee Management System project in PHP Last Updated: January 21, 2023