我有一个锂 Html 帮助链接
<?php echo $this->html->link('Delete', array('action' => 'delete', 'args' => $id); ?>
单击此链接时,我希望显示一个确认框,但我在文档中看不到任何允许我执行此操作的内容。
这可能吗?
我有一个锂 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>