2012-03-09 86 views
0

我有一個鋰HTML輔助鏈接鋰:顯示確認對話框時單擊鏈接

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

當這個鏈接被點擊我想確認框展現出來,但我不能看到什麼文件,這將允許我這樣做。

這可能嗎?

+2

不確定它會工作,但嘗試添加第三個參數:'$ options = array('onclick'=>「return confirm('Are you sure?')」)' – 2012-03-09 11:25:26

回答

1

正如DVIR沃爾克提供這個功能可以使用以下來解決:

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

我會使用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>