JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    This form will not be saved
    <input type="text" />
</form>
<br /><br />
<form id="myForm">
    This form will be saved
    <input name="txtFname" id="txtFname" value="Bob" type="text" />
    <input name="txtLname" id="txtLname" value="Jones" type="text" />
</form>

JavaScript

setInterval(function() {																													
    $("#myForm").checkDirty();
},10000);
$("#myForm :input").each(function() {
    $(this).data('formValues', $(this).val());
});

$.fn.checkDirty = function() {
    var isDirty = false;
    var change_str = "";
    $(this).find(':input').each(function () {
        if($(this).data('formValues') != $(this).val()) {
            isDirty = true;
            change_str = $(this).attr('name') + " changed from " + $(this).data('formValues') + " to " + $(this).val();
        }
    });

    if(isDirty == true){
        alert(change_str);
    }
};