Re: [jQuery] Re: How to compare data in 2 jQuery data() elements

2009-12-17 Thread Michael Geary
I think you guys are making this too complicated. Just loop through the data properties: function dataChanged( a, b ) { for( var key in a ) if( a[key] != b[key] ) return true; return false; } if( dataChanged(o,n) ) { someAJAXFunctionThatSavesTheFiel

[jQuery] Re: How to compare data in 2 jQuery data() elements

2009-12-17 Thread discern
Thanks. I'll give that a go. Otherwise, I'll just write 2 different functions: one for comparison (I'll probably compare hashes using the sha1 plugin) and one for sending the data to the backend.

[jQuery] Re: How to compare data in 2 jQuery data() elements

2009-12-16 Thread Dave Methvin
>  var o = $("#original-fields"), n = $("#new-fields"); >  if (o != n) { // <-- BRICK WALL >   someAJAXFunctionThatSavesTheFieldsThatChanged(); >  } > How can I compare the #original-fields data with the #new-fields > data?  As it is, the two always differ; I assume this is because they > are diff