Answer the question
In order to leave comments, you need to log in
Modal window, jquery doesn't accept id. Where is the mistake?
I have a grid table with a column
[
'class' => 'yii\grid\ActionColumn',
'template' => '{select}',
'buttons' => [
'select' => function($url){
return Html::a('<span class="glyphicon glyphicon-share" style="color:#228B22"></span>',$url, [
'title' => 'Выбрать пункт приема',
'class' => 'select',
'data-toggle' => 'modal',
'data-target' => 'unload'
]);
}
]
]
<div class="modal fade" id="unload" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title" id="exampleModalLabel">Пункт приема</h2>
</div>
<div class="modal-body">
<p>....</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success">Save changes</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php $this->registerJs(
"
$('.select').on('click', function(){
var data = $(this).data();
$('#unload').modal('show');
$('#unload').find('.modal-title').text('id:' + data.key);
});
"
); ?>
$('.grid-view tbody tr').on('click', function()
Answer the question
In order to leave comments, you need to log in
if you have already specified 'data-toggle' => 'modal', then why are you processing the click again. She does it twice. Perhaps this is the problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question