JSFiddle - React, Tailwind, and code Playground

by Maria

HTML

<section id="quiz-number-one">
    <p>Get my text!</p>
    <p>Show everything, including this <span>span</span> tag!</p>
    <p>Tell me if my child element equals 9633 + 1. <b>9634</b>
    </p>
    <article>You're almost there, just show what kind of node this is (the node's "name", if you will.)</article> <i>Super-bonus marks: open the url in the contents of the next element in a new window</i>

     <h5>http://coned.georgebrown.ca/owa_prod/cewskcrss.P_CrseGet?subj_code=COMP&crse_numb=9634</h5>

</section>

JavaScript

/* Get my text! */
var myText = document.body.textContent;
alert(myText);

/* Show everything */
var showEverything = document.body.innerHTML;
alert(showEverything);

/* Does child element equal 9634 */

var section = document.body.firstElementChild;
var sectionFirstChild = section.firstElementChild;
var sectionSecondChild = sectionFirstChild.nextElementSibling;
var sectionThirdChild = sectionSecondChild.nextElementSibling;
var sectionFourthChild = sectionThirdChild.nextElementSibling;
var sectionFifthChild = sectionFourthChild.nextElementSibling;
var sectionSixthChild = sectionFifthChild.nextElementSibling;


if (sectionThirdChild.firstchild == 9634) {
    alert("The child's element is 9634");
} else {
    alert("The child's element does not equal 9634");
}

/* BONUS */
window.open(sectionSixthChild.innerHTML);