I have this feature where it checks the data to get out of the page, what happens is that some data looks like this disabled
I can not verify the data according to the data entered.
$(function () {
var init_form = $('#Novo').serialize();
$(':submit').click(function () { window.onbeforeunload = null; });
window.onbeforeunload = function () {
var check_form = $('#Novo').serialize();
console.log(init_form);
console.log(check_form);
if (check_form === init_form) return null;
return 'Os dados do formulário não foram salvos, deseja permanecer nesta página?';
};
});
I tried to insert this line into the method $("#Novo :input").prop('disabled', false);
but it did not work either.
$(function () {
var init_form = $('#Novo').serialize();
$(':submit').click(function () { window.onbeforeunload = null; });
$("#Novo :input").prop('disabled', false);
window.onbeforeunload = function () {
var check_form = $('#Novo').serialize();
console.log(init_form);
console.log(check_form);
if (check_form === init_form) return null;
return 'Os dados do formulário não foram salvos, deseja permanecer nesta página?';
};
});
How can I ensure that all data is checked, regardless of whether it is a property? disabled
or readonly
is like true
,