I am trying to use SimonLammer’s anki-persistence to achieve the following:
- On the front side, there is a
<textarea>
element, in which I will input some text. - Upon the page-flip button being clicked (should trigger the “beforeunload” event), we will use anki-persistence to store the text that will be in the text box.
- Upon the DOM being loaded on the back side, we will retrieve the stored content and bestow it onto another element.
document.onload = pycmd('ans');
flips the card to the back side, so “onload” works at least to this extent.
However, the following simple test does not work
document.onload = function() {
var box = document.getElementById("sentences");
box.innerText = "text";
};
Why?
“beforeunload” also seems to do nothing.