Babel includes JSX processing.
Any URL's added here will be added as
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html> <head> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"> <title>Get access to the DOM</title> </head> <body> <div class="container"> <header id="page-header" class="bg-dark text-white col-sm-12"> <h1 id="main-heading" class="text-center">Get access to the DOM</h1> </header> <div class="row"> <main class="col-sm-8"> <article id="art-001" class="m-2 p-2 border border-secondary"> <h3>Article 001</h3> <p> Ask to be pet then attack owners hand jumps off balcony gives owner dead mouse at present then poops in litter box snatches yarn and fights with dog cat chases laser then plays in grass finds tiny spot in cupboard and sleeps all day jumps in bathtub and meows when owner fills food dish the cat knocks over the food dish cat slides down the water slide and into pool and swims even though it does not like water or meowzer, </p> </article> <article id="art-002" class="m-2 p-2 border border-secondary"> <h3>Article 002</h3> <p> Attack dog, run away and pretend to be victim hunt by meowing loudly at 5am next to human slave food dispenser cough furball so all of a sudden cat goes crazy. Stare at ceiling light. Meow scream at teh bath missing until dinner time, yet human is washing you why halp oh the horror flee scratch hiss bite or scratch at fleas, meow until belly rubs, </p> </article> <article id="art-003" class="m-2 p-2 border border-secondary"> <h3>Article 003</h3> <p> Try to hold own back foot to clean it but foot reflexively kicks you in face, go into a rage and bite own foot, hard stares at human while pushing stuff off a table chase dog then run away. Jump on human and sleep on her all night long be long in the bed, purr in the morning and then give a bite to every human around for not waking up request food, </p> </article> </main> <aside id="sidebar" class="col-sm-4 bg-info text-white"> <h4>Sidebar</h4> </aside> </div> </div> <script src="./scripts.js"></script> </body> </html>
// Get access to the DOM const articles = document.getElementsByTagName('article'); const paragraphs = document.getElementsByTagName('p'); const firstArticle = articles; const secondParagraph = paragraphs; const whiteTextElements = document.getElementsByClassName('text-white'); const sidebar = document.getElementById('sidebar'); // Modify the DOM const mainHeading = document.getElementById('main-heading'); mainHeading.textContent = 'Modify the DOM'; const header = document.getElementById('page-header'); header.innerHTML = '<h2>Modify the DOM</h2>';
Also see: Tab Triggers