2 回答

TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超9個(gè)贊
這是有意義的解決方案。
步驟1)在按鈕中添加數(shù)據(jù)-###,并且它必須位于指定標(biāo)題之前。
<a href="#"><i class="bx bxs-edit text-primary bx-sm edit" data-name="{{old('name') ?? $document->name}} " title="Edit Document"></i></a>
步驟2)在腳本中,您可以使用示例“$(this).data('name');”來獲取數(shù)據(jù)
<script type="text/javascript">
$(document).ready( function () {
//Getting the datatable ready
var table = $('#indextable').DataTable();
//if the edit button is clicked
table.on('click', '.edit', function(){
var nameData = $(this).data('name');
$("#name").val(nameData);
$('#editModal').modal('show');
});
});
//On error keep the modal open
@if (count($errors) > 0)
$('#editModal').modal('show');
@endif
</script>

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超4個(gè)贊
例如,另一種選擇是重新刷新會(huì)話;
//On error keep the modal open
@if (count($errors) > 0)
{{ Session::reflash()}}
$('#editModal').modal('show');
@endif
old('value')然后您可以在模態(tài)視圖中使用標(biāo)準(zhǔn)語法。
- 2 回答
- 0 關(guān)注
- 167 瀏覽
添加回答
舉報(bào)