diff --git a/idb-notes.html b/idb-notes.html
index b516e04..cc4536a 100644
--- a/idb-notes.html
+++ b/idb-notes.html
@@ -274,7 +274,10 @@ function saveDocument(text) {
content: text,
created: new Date().toLocaleString()
};
- store.add(doc);
+ const addReq = store.add(doc);
+ addReq.onsuccess = function(event) {
+ currentDocId = event.target.result;
+ };
}
tx.oncomplete = function() {