使用每个id创建的模态框。但是当点击进入按钮时没有弹出。检查元素中没有显示错误。
<?php
if (!empty($listDetails)) {
$i = $page;
foreach ($listDetails as $listDet)
{
$i++;
?>
<tr class="odd gradeX">
<td style="text-align: center;"><?php echo $i; ?></td>
<td style=""><?php echo $listDet['benefits_title']; ?></td>
<td style=""><?php echo date('d-m-Y', strtotime($listDet['benefits_start_date'])); ?></td>
<td style=""><?php echo date('d-m-Y', strtotime($listDet['benefits_end_date'])); ?></td>
<td style="">
<?php if($listDet['featured_benefits']==0){?>
<span class="btn btn-block btn-danger btn-xs">No</span>
<?php } else if($listDet['featured_benefits']==1){?>
<span class="btn btn-block btn-success btn-xs">Yes</span>
<?php } ?>
</td>
<td style="">
<?php if($listDet['status']==0){?>
<span class="btn btn-block btn-danger btn-xs">Expired</span>
<?php } else if($listDet['status']==1){?>
<span class="btn btn-block btn-success btn-xs">Ongoing</span>
<?php } ?>
</td>
<td style="text-align: center;">
<a href="javascript:void(0)" style="color:#1385e5" data-toggle="modal" title="View" data-target="#myModal_<?php echo $listDet['benefits_id']; ?>" ><i class="fa fa-search-plus fa-fw"></i></a>
<?php if($this->utp==1) {?>
<a href="<?php echo site_url('settings/benefit_schema/'.encData($listDet['benefits_id']))?>" style="color:#060" class="change_stat" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a>
<a href="javascript:void(0)" onClick="return del('<?php echo $listDet['benefits_id']; ?>');">
<i class="fa fa-trash text-danger" title="Delete"></i>
</a>
<?php } ?>
</td>
</tr>
<?php }
?>
<tr><td colspan="7"><div class="ajax_pag" style="text-align: right;"><?php echo $links; ?></div></td></tr>
<?php } else{?>
<tr class="">
<td style="text-align: center; color: red;" class=" no-data" colspan="7" > No data found !</td>
</tr>
<?php } ?>
<?php
if (!empty($listDetails))
{
foreach ($listDetails as $listDet)
{
?>
<div class="modal" id="myModal_<?php echo $listDet['benefits_id'] ?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Schema Details</h4>
</div>
<div class="modal-body">
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Title</strong></div>
<div class="col-lg-6"> <?php echo $listDet['benefits_title']; ?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Applicable To</strong></div>
<div class="col-lg-6"> <?php if($listDet['applicable_to']==0) echo "Both"; else if($listDet['applicable_to']==1) echo "Private Customer"; elseif($listDet['applicable_to']==2) echo "Corporate Customer";?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Description</strong></div>
<div class="col-lg-6" style="text-align: justify;"> <?php echo $listDet['benefits_description']; ?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Start date</strong></div>
<div class="col-lg-6"> <?php echo date('d-m-Y', strtotime($listDet['benefits_start_date'])); ?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>End Date</strong></div>
<div class="col-lg-6"> <?php echo date('d-m-Y', strtotime($listDet['benefits_end_date'])); ?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Featured</strong></div>
<div class="col-lg-6"> <?php if($listDet['featured_benefits']==0) echo "No"; else echo "Yes";?></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Image</strong></div>
<div class="col-lg-6"> <img src="<?php echo base_url('assets/uploads/schema/images/'.$listDet['benefits_image']);?>" width="50" height="50"/></div>
</div>
<div class="col-lg-12" style="margin-top: 2%;">
<div class="col-lg-6"><strong>Supporting Files</strong></div>
<div class="col-lg-6"> <?php echo $listDet['benefits_file']; ?></div>
</div>
</div>
<div class="modal-footer" style="border-top:0px;"></div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php
}
}
?>