Joh*_* Uy 1 javascript jquery codeigniter
即使我取消我的确认表格仍然提交了什么问题?我认为我的jquery是错误的帮助
表格外的我的按钮
<li><a id="recieve_btn" href="javascript:void(0)" class="btn animated infinite pulse" onclick="if(!confirm('Are you sure?')) return false;"><span class="glyphicon glyphicon-transfer"></span> Recieve</a></li>Run Code Online (Sandbox Code Playgroud)
我的表格
<form id="frm-list" action="<?php echo base_url('home/recieve') ?>">
<table class="table table-condensed display dataTable dt-checkboxes-select" id="list" style="width: 100%;">
<thead>
<tr>
<th>No</th>
<th>Family Name</th>
<th>Given Name</th>
<th>Middle Initial</th>
<th>Birthdate</th>
<th>Module Enrolled</th>
<th>Action</th>
</tr>
</thead>
<tbody class="datatable">
<?php foreach ($result as $trainee): ?>
<tr>
<td><?php echo $trainee->no ?></td>
<td><?php echo $trainee->lname ?></td>
<td><?php echo $trainee->fname ?></td>
<td><?php echo $trainee->mi ?></td>
<td><?php echo $trainee->bdate ?></td>
<td><?php echo $trainee->module ?></td>
<td>
<a href="javascript:void(0);" class="btn btn-primary btn-sm animated infinite pulse" data-registerid="<?php echo $trainee->no ?>" id="update">Update</a>
</td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th>Family Name</th>
<th>Given Name</th>
<th>Middle Initial</th>
<th>Birthdate</th>
<th>Module Enrolled</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</form>Run Code Online (Sandbox Code Playgroud)
我提交表格的jquery
$(document).on('click', '#recieve_btn', function(){
$('#frm-list').trigger('submit');
});Run Code Online (Sandbox Code Playgroud)
请试试这段代码.它可能会帮助你.
$(document).on('click', '#recieve_btn', function() {
if (confirm('Are you sure?')) {
$('#frm-list').trigger('submit');
} else {
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43 次 |
| 最近记录: |