My jquery will check if I have entered input into my form, but how do I detect a change made by javascript?
<p>This code will detect if a change is made by a user to one of the inputs on a form;</p>

<pre><code>$(document).ready(function () {
    var isDirty = false;
    $(".formTable :input, select, textarea").change(function () {
        isDirty = true;
    });
</code></pre>

<p>However on my form I have a popup, and the form is updated from this using javascript. The above code does not pick this up, so what can I do so it does?</p>

<pre><code>   $('.dialogLink').live('click', function () {
        var element = $(this);

        // Retrieve values from the HTML5 data attributes of the link        
        var dialogTitle = element.attr('data-dialog-title');
        var updateTargetId = '#' + element.attr('data-update-target-id');
        var updateTargetId2 = '#' + element.attr('data-update-target-id2'); 

        // Generate a unique id for the dialog div
        var dialogId = 'uniqueName-' + Math.floor(Math.random() * 1000);
        var dialogDiv = "&lt;div id='" + dialogId + "'&gt;&lt;/div&gt;";

        // Load the form into the dialog div
        $(dialogDiv).load(this.href, function () {
            $(this).dialog({
                bgiframe: true,
                modal: true,
                width: 500,
                title: dialogTitle,
                buttons: {
                    "Add": function () {
                        // Manually submit the form                        
                        var form = $('form', this);
                        $(form).submit();
                    },
                    "Cancel": function () { $(this).dialog('close'); }
                }
            });
            // Enable client side validation
            $.validator.unobtrusive.parse(this);

            // Setup the ajax submit logic
            wireUpForm(this, updateTargetId, updateTargetId2);
        });
        return false;
    });
});

function wireUpForm(dialog, updateTargetId, updateTargetId2) {
    $('form', dialog).submit(function () {

        // Do not submit if the form
        // does not pass client side validation
        if (!$(this).valid())
            return false;

        // Client side validation passed, submit the form
        // using the jQuery.ajax form
        $.ajax({
            url: this.action,
            type: this.method,
            data: $(this).serialize(),
            success: function (result) {
                // Check whether the post was successful
                if (result.success) {
                    // Close the dialog 
                    $(dialog).dialog('close');

                    // UPDATE IS DONE HERE
                    $(updateTargetId).val(result.newTradeName);
                    $(updateTargetId2).val(result.newTradeId);
                    $(updateTargetId).attr("readonly", "readonly");
                } else {
                    // Reload the dialog to show model errors                    
                    $(dialog).html(result);

                    // Enable client side validation
                    $.validator.unobtrusive.parse(dialog);

                    // Setup the ajax submit logic
                    wireUpForm(dialog, updateTargetId, updateTargetId2);
                }
            }
        });
        return false;
    });
}
</code></pre>
