I need to show a message called expired near the title of each row if the end date is less than todays date. This is going to be done using hover in jquery.
My table view is below:
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Title</th>
<th scope="col">Start Date</th>
<th scope="col">End Date</th>
<th scope="col">Description</th>
<th scope="col">Edit</th>
</tr>
</thead>
<tbody>
<?php foreach($offerList as $info){ ?>
<tr>
<td><a href="<?php echo base_url()."offer/publicview/?id=".urlencode($this->encrypt->encode($info->offid)); ?>"><?php echo $info->title; ?></a></td>
<td><?php echo $info->startdate; ?></td>
<td><?php echo $info->enddate; ?></td>
<td><?php echo $info->discrip; ?></td>
<td>
<a href="<?php echo base_url()."offer/edit/?id=".urlencode($this->encrypt->encode($info->offid)); ?>">Edit</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
jquery :
<script>
var today = t.getDate() + '/' + (t.getMonth()+1) + '/' + t.getFullYear() ;
$( "tr" ).hover(
function() {
$( this ).append( $( "<span> expired </span>" ) );
}, function() {
$( this ).find( "span:last" ).remove();
});
$( "tr.fade" ).hover(function() {
$( this ).fadeOut( 100 );
$( this ).fadeIn( 500 );
});
</script>
I need to get the end date of each row and compare it with todays date. And if the end date is less than todays date then the message should be shown near the title.
Any idea on doing this? I have no idea on how to get the end date of each row.