ProAnswers.org

jQuery forms elements change

In jQuery, is there a simple way to test if ANY of a forms elements have changed?

$(’#mybutton’).click(function()
{
if( FORM has changed )
{ do something
}
});

how I come to know that if the form has changed since it was loaded?

Try this:

				 $("form :input").change(function()


			
				{ 
				  $(this).closest('form').data('changed', true); 
				}); 
				$('#mybutton').click(function() { 
				  if($(this).closest('form').data('changed')) { 
				     //do something 
				  } 
				});