MediaWiki:JSExample.js

// Owner: Rus setTimeout(=> {   let templateName = 'JSExample'; // your template name here    try {        let template = Utils.get(templateName);        if(template == undefined) return;        let greeting = Utils.createElement("div", {textContent: "Hello!", fontSize: "20px"})        let input = Utils.createElement("textarea")        let div = Utils.createElement("div")        let button = Utils.createElement("button", {textContent: "Click me!"})

input.oninput = e => { div.textContent = input.value }

button.onclick = e => { alert(div.textContent); }       template.appendChild(Utils.bundle([greeting, input, div, button])) } catch (err) { document.getElementById(templateName).style.color = "red"; document.getElementById(templateName).style.fontSize = "30px"; document.getElementById(templateName).style.border = "1px solid red"; document.getElementById(templateName).style.textAlign = "center"; document.getElementById(templateName).textContent = "JS could not be loaded!" } },500)