繁体   English   中英

锂:单击链接时显示确认框

[英]Lithium: Show confirm box when link is clicked

我有一个锂HTML助手链接

<?php echo $this->html->link('Delete', array('action' => 'delete', 'args' => $id); ?>

单击此链接后,我希望显示一个确认框,但是我在文档中看不到任何允许我执行此操作的内容。

这可能吗?

如Dvir Volk提供的,可以使用以下方法解决:

<?php echo $this->html->link('Delete', array('action' => 'delete', 'args' => $id), array('onclick', 'return confirm("Are you sure you wish to delete this item?")'); ?>

我将使用jquery向其添加事件。

<?php echo $this->html->link (
    'Delete', 
    array(
        'action' => 'delete', 
        'args' => $id, 
        'class' => 'delete'
    )
); ?>

<script>
    $('a.delete').click(function(){
        confirm("Are you sure you wish to delete this item?");
    });
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM