在 yii2 中使用 javascript 单击按钮显示或隐藏任何表单
show or hide any forms by clicking a button using javascript in yii2
如何在单击Gridview按钮时显示表单?
基本上我想填充一个表单,其中包含下拉和提交按钮。
通过单击按钮,我想在弹出框中填充表单。
'panel' => [
'type' => 'info',
'after' => Html::button('<i class="glyphicon glyphicon-plus"></i> Allocate', [ 'id' => 'modalButton', 'class' => 'btn btn-success'),
'showFooter' => false,
使用以下代码解决了我的问题。
$this->registerJs("$(function() {
$('#popupModal').click(function(e) {
e.preventDefault();
$('#modal').modal('show').find('.modal-content')
.load($(this).attr('href'));
});
});");
如何在单击Gridview按钮时显示表单?
基本上我想填充一个表单,其中包含下拉和提交按钮。
通过单击按钮,我想在弹出框中填充表单。
'panel' => [
'type' => 'info',
'after' => Html::button('<i class="glyphicon glyphicon-plus"></i> Allocate', [ 'id' => 'modalButton', 'class' => 'btn btn-success'),
'showFooter' => false,
使用以下代码解决了我的问题。
$this->registerJs("$(function() {
$('#popupModal').click(function(e) {
e.preventDefault();
$('#modal').modal('show').find('.modal-content')
.load($(this).attr('href'));
});
});");