Mouse Click Button without HTML

Hi all,
I have done the Mouse Click Button assignment without using HTML.


    let btn = document.createElement("button");
    btn.innerHTML = "Click here to win new Iphone 12 pro";
    btn.addEventListener("click", function () {
      alert("Oh man, That was just a joke.");

What do you think about such a solution for it?

Best wishes,
Kacper Pajak

Yup this works if you need to add extra functionality. :slight_smile:

Is it better than that one Ivan shows with using HTML?
Is it good to do so?
is it a bad manner?

Both approaches are good. There’s not much difference as such.