Refactored the code to autosave using the jQuery keyboard event keyup().