` element. It then sets `click` and `keypress` event listeners on the `
`, both of which run a custom function called `addParagraph()` when the event fires.
+
+```js
+const divElem = document.querySelector("div");
+divElem.addEventListener("click", addParagraph);
+window.addEventListener("keypress", addParagraph);
+```
+
+The `addParagraph()` function generates a new paragraph element and appends it to the end of the `
` as a child, increasing its height. It then calls `requestResize()` so that the new height is reported to the parent page.
+
+```js
+function addParagraph() {
+ const para = document.createElement("p");
+ para.textContent = "New content.";
+ divElem.appendChild(para);
+ window.requestResize();
+}
+```
+
+#### Result
+
+{{EmbedGHLiveSample("responsive-iframe-sizing/js-request-resize/", "100%", 300)}}
+
+Even though no explicit `height` has been set on the `