UNIT 12 • STAGE 5 OF 7
Publish your research writing on your site: the section that is entirely yours
Every other section in your site was either pre-built or filled in from vetted sources. The My Research section is different. It contains only your writing, your voice, and your analysis of the topic you chose to investigate.
Scroll to the bottom of the Live Preview to see the My Research section. It has a two-panel layout: the left panel is the input area (the <textarea> in your HTML), and the right panel is the styled, published version that updates as you type.
There is a small JavaScript function in the code that watches the <textarea> for changes. Every time the content changes, it reads the text, splits it into paragraphs, and displays each paragraph in the styled output panel on the right. When you edit the textarea content in your code editor, the preview refreshes and the research output updates automatically.
The live update uses a JavaScript event you have not seen before: oninput. Here is how it is wired up:
You have already used onclick (fires on click) and onkeydown (fires on key press). oninput fires whenever the value of an input or textarea element changes, whether from typing, pasting, or any other edit. It is the right event for a live-preview text editor.
The function splits the textarea value on double line breaks (which is how Google Docs separates paragraphs when you copy text). Each chunk becomes a <p> tag in the output. This is the same pattern used in real-world rich text editors.
This is the main task for Stage 5. Here is the full process:
<textarea id="research-input"> element.The textarea in the HTML looks like this: <textarea id="research-input">placeholder text here</textarea>. You are replacing the text between those tags with your own writing. The textarea tags stay. Only the content changes.
Find the .research-byline element in your code. It contains two placeholders: [Your Name] and [Your Topic]. Replace both with your actual name and the topic you researched.
Your research is now published on your site. In Stage 6 you will add two more sections: How This Era Shapes Us Today (with three reflection cards, one of which you write yourself) and the footer with your sources list.