Displaying change of content through parent

Posted by Mikhail on Stack Overflow See other posts from Stack Overflow or by Mikhail
Published on 2011-03-06T00:07:10Z Indexed on 2011/03/06 0:10 UTC
Read the original article Hit count: 207

Filed under:
|
|

I have DHTML content inside a fieldset. This includes plain html, nested objects (even other fieldsets), and value change of input, select, and textarea objects.

I'd like to change the border of the fieldset if the contents have been changed. The following works:

$('fieldset[name=qsfs127]').children('input').change(function(){
    $(this).parent('fieldset').css({border:'1px solid red'});
})

This handles the input; I can extend it to select and textarea.

Questions:

  1. How can I do the same for html changes?
  2. Can all of this change-tracking be done by comparing current html() to stored one?
  3. If yes for (2), will this handle cases of "undo"?

Edit: I have a button that ajax-uploads contents, and saves the changes. I then remove the border color

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dhtml