-1

Possible Duplicate:
trigger an event when contenteditable is changed

I have a table on my page (generated with PHP) that I've enabled 'Contenteditable' for. Once the user loads the table, they can click on any of the table cells and change the values locally. I would like to bind a function onto the table cells so that any change locally would be pushed back to the server. The natural way to do this would be to bind an 'OnChange' event to each generated table cell. But since I am not working with a traditional HTML form, 'OnChange' isn't an option. Is there a way for me to mimic the 'OnChange' event on each data cell of my table?

Community
  • 1
  • 1
Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248
  • I think a combination of the link above and some AJAX will do it for you. Very approximate jQuery-ish pseudo code: `$(elem).change(function() { $.ajax(url, $(this).val()); });` – Andrew Dec 06 '12 at 19:34

1 Answers1

0

You could try a little library I once wrote: OnChange on Github then you could try this:

OnChange.set("document.queryString('#tablecell').innerHTML", function() {
    //AJAX-stuff here. new content is in var 'newval'.
});
ninov
  • 629
  • 1
  • 6
  • 17