I am trying to alert some data on the click on Create Quiz and it is working on the first page but on other pages, the alert is not working. I have attached the image for the table
I have tried to find on google, but nothing is available regarding this in datatables.
HTML CODE:
<table id="post-table" class="table display-table table-striped table-
bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Class</th>
<th>Published</th>
<th>Quiz</th>
<th>Create Quiz</th>
<th>View Quiz</th>
</tr>
</thead>
<tbody>
<?php foreach ($allposts as $allpost) { ?>
<tr>
<td><?php echo $grades->getGradename($allpost['grade_id']); ?></td>
<td><?php echo $others->milliToTime($allpost['created_at']); ?></td>
<td><?php echo $quiz->quizCount($allpost['post_id']); ?></td>
<td>
<a href="#" data-post-id='<?php echo $allpost['post_id']; ?>' class="create-quiz"><i class="fa fa-plus-circle" aria-hidden="true"></i></a>
</td>
<td><a href="/admin/quiz/allquiz.php?post_id=<?php echo $allpost['post_id'] ?>"><i class="fa fa-eye" aria-hidden="true"></i></a></td>
</tr>
<?php } ?>
</tbody>
</table>
SCRIPT
$('#post-table').DataTable({
"bSort": false
});
$('.create-quiz').click(function(e){
e.preventDefault();
alert("ss");
});