[英]If the Delete link is clicked, show a JavaScript confirm pop-up box to the user
[英]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.