79347838

Date: 2025-01-11 09:53:01
Score: 0.5
Natty:
Report link

The culprit is the line:

this._div.innerHTML += "some info";

It destroys (and then recreates) all child elements of this._div so the event listener associated with the original button is lost.

If you replace this line with say:

let contentDiv = L.DomUtil.create("div", "info-content", this._div);
contentDiv.innerHTML = "some info";

the button will work as intended.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: the.real.gruycho