我有一个锂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>