DOM Controls that do things

From ProgZoo
Revision as of 17:55, 4 September 2021 by Andr3w (talk | contribs)
Jump to navigation Jump to search

let b = document.createElement('button');
b.innerText = 'click me';
b.onclick = ()=>{
  document.body.append('Hello world');
}
document.body.append(b);
let b = document.createElement('button');
b.innerText = 'click me';
b.onclick = ()=>{
  document.body.append('Hello world');
}
document.body.append(b);