在yii中删除后如何显示确认消息?

时间:2019-02-06 09:47:09

标签: javascript php yii2

我正在使用Html :: submitButton作为删除按钮,按下删除按钮后需要确认消息。

<?= Html::submitButton('Delete', ['name' => 'delete', 'value' => 0, 'id' => 'delete1', 'class' => 'pull-left btn btn-danger']) ?>

有人知道怎么做吗?

1 个答案:

答案 0 :(得分:1)

尝试以下代码:

<?= Html::submitButton('Delete', ['name' => 'delete', 'value' => 0, 'id' => 'delete1', 'class' => 'pull-left btn btn-danger', 'data-confirm' => 'Are you sure you want to delete this item?']) ?>

<?= Html::submitButton('Delete', ['name' => 'delete', 'value' => 0, 'id' => 'delete1', 'class' => 'pull-left btn btn-danger', 'confirm' => 'Are you sure you want to delete this item?']) ?>