Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

JavaScript/Restructure DOM/Exercises

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Topic: Restructure the DOM tree 1. We use the HTML page of the previous page for the exercises. Write a script that moves the two <div> sections BEFORE the button. 100% function show() { "use strict"; // select the body element. It's the parent. const body = document.getElementById("body"); // select the button element const button = document.getElementById("buttonShow"); // select the 'div' elements const div_1 = document.getElementById("div_1"); const div_2 = document.getElementById("div_2"); // move the div elements BEFORE the button body.insertBefore(div_1, button); body.insertBefore(div_2, button); }