function isFormValuesChanged() { var isDirty = false; try{ $(':input').each(function () { if($(this).data('initialValue') != 'undefined' && $(this).val() != 'undefined' && $(this).data('initialValue') != $(this).val()){ isDirty = true; } }); }catch(e){ } return isDirty; }