作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
大家好,我在 CI 脚本上使用 Modal 作为删除提示,但它不起作用,也许有错误。任何人都可以帮我检查代码。
我的删除按钮代码:
<a onclick="confirm_modal(<?php echo base_url('threads/deletereplytopic/'.$toprep['id']) ?>)" style="cursor:pointer;" data-toggle="modal" data-target="#deleteReplyTopic"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
我的 Modal 和 Js 代码:
<!-- Delete Topic Reply Modal-->
<div class="modal fade" id="deleteReplyTopic" style="display: none;" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title"><?php echo lang_key('confirm_delete'); ?></h6>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<?php echo lang_key('confirm_delete_text'); ?>
</div>
<div class="modal-footer">
<a class="btn btn-danger" id="delete_topic_reply" href=""><?php echo lang_key('delete'); ?></a>
<button type="button" class="btn btn-info" data-dismiss="modal" id="delete_cancel_link"><?php echo lang_key('cancel'); ?></button>
</div>
</div>
</div>
</div>
和 Js:
<!-- Delete Topic JS -->
<script>
function confirm_modal(delete_url)
{
jQuery('#deleteReplyTopic').modal('show', {backdrop: 'static',keyboard :false});
jQuery("#deleteReplyTopic .grt").text(title);
document.getElementById('delete_topic_reply').setAttribute("href" , delete_url );
document.getElementById('delete_topic_reply').focus();
}
</script>
这是我的 Controller 代码:
public function deletereplytopic($id='') {
$deletereply = array(
'id' => $id,
'status' => 0
);
$deltop = 'confirmdelete';
$this->session->set_flashdata('deltop', $deltop);
$this->topic_model->deleteReplyTopic($deletereply);
}
如果我直接删除数据,这个 Controller 代码可以工作,但如果我使用模态则不起作用..我希望有人可以帮助我..
最佳答案
您缺少引号,例如confirm_modal('某事')
<a onclick="confirm_modal('<?php echo base_url('threads/deletereplytopic/'.$toprep['id']) ?>')" style="cursor:pointer;" data-toggle="modal" data-target="#deleteReplyTopic"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
关于javascript - 在 Codeigniter 中使用模态 Bootstrap 作为删除提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47897355/
我来自 Asp.Net 世界,试图理解 Angular State 的含义。 什么是 Angular 状态?它类似于Asp.Net中的ascx组件吗?是子页面吗?它类似于工作流程状态吗? 我听到很多人
我一直在寻找 3 态拨动开关,但运气不佳。 基本上我需要一个具有以下状态的开关: |开 |不适用 |关 | slider 默认从中间开始,一旦用户向左或向右滑动,就无法回到N/A(未回答)状态。 有人
我是一名优秀的程序员,十分优秀!