TOC
wwworkshop
Uni Köln

3.2
Manipulating the page with a script

Instead of opening a browser dialog, we might wish to instead display something on the website itself. There are a lot of different ways to do so. One of the basics is to create a new element using document.createElement, set its text with innerText

script.js

const paragraph = document.createElement('p')
paragraph.innerText = 'wwwow!'
document.body.appendChild(paragraph)