0
I have this function to check if something has changed in formulário
, apparently it worked perfectly:
$(function () {
var init_form = $('#editarproduto').serialize();
$(':submit').click(function () { window.onbeforeunload = null; }); window.onbeforeunload = function () { var check_form = $('#editarproduto').serialize(); console.log(check_form); console.log(init_form); if (check_form === init_form) return null; return 'Os dados do formulário não foram salvos, deseja permanecer nesta página?'; };
});
But the need arose for it checks the table
, if something was hidden in it, it does not catch the changes in this table
:
<table class="table table-responsive table-hover" id="tabelaf" name="tabelaf">
<tbody>
@foreach (var item in Model.ProdutosFornecedores)
{
<tr class="tr item">
<td>@item.FornecedorProduto.Id</td>
<td>@item.FornecedorProduto.Nome</td>
<td align="right">
<a class="link-excluir" href="#" data-id="@item.Id" title="Excluir"><i class="fa fa-trash-o fa-lg"></i></a>
</td>
</tr>
}
</tbody>
</table>
How to make him compare this table
also ?
I did exactly that, I put the Hidden type and it worked,
– Mariana