Markdown Previewer - Showing Changes to `textarea` element in Preview in real time? I'm stuck

Hi, everyone.

I’m stuck here. What am I doing wrong? Here is my code. It’s for the Markdown Previewer in the Front-End Libraries Projects; here’s a link.

I have the initial markdown from the id="editor" element rendered in the id="preview" element as HTML, but I can’t figure out how to render the changes to the former to the latter as HTML in real time as the user makes changes to the editor element.

Any help is appreciated. Thanks in advance.

You initially set the markdown variable at the top of the JS, but where are you updating it as the user changes the text in the editor?

Thanks. That helped.

I did this:

editor.on("keyup keypress blur change", () => {
  markdown = editor.val();
  editCallback();
});

Here’s the full code. Is it fine like this? The layout and stuff.