Refactor autosave function to use jQuery keyup