Difference between revisions of "DOM Controls that do things"

From ProgZoo
Jump to navigation Jump to search
(Created page with "<pre id='shellbody' data-qtp='fetch'></pre> <div class=qu> <pre class=usr> let b = document.createElement('button'); b.innerText = 'click me'; b.onclick = ()=>{ document.bod...")
 
Line 5: Line 5:
b.innerText = 'click me';
b.innerText = 'click me';
b.onclick = ()=>{
b.onclick = ()=>{
   document.body.append('Ho=ello world');
   document.body.append('Hello world');
}
}
document.body.append(b);
</pre>
</pre>
<pre class=ans>
<pre class=ans>
Line 12: Line 13:
b.innerText = 'click me';
b.innerText = 'click me';
b.onclick = ()=>{
b.onclick = ()=>{
   document.body.append('Ho=ello world');
   document.body.append('Hello world');
}
}
document.body.append(b);
</pre>
</pre>
</div>
</div>

Revision as of 00:33, 30 August 2021


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);