题
我有一个锂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>
. 不隶属于 StackOverflow