diff --git a/src/L.Control.Sidebar.js b/src/L.Control.Sidebar.js index 9e37148..c7b8af4 100644 --- a/src/L.Control.Sidebar.js +++ b/src/L.Control.Sidebar.js @@ -162,7 +162,19 @@ L.Control.Sidebar = L.Control.extend({ }, setContent: function (content) { - this.getContainer().innerHTML = content; + var container = this.getContainer(); + + if (typeof content === 'string') { + container.innerHTML = content; + } else { + // clean current content + while (container.firstChild) { + container.removeChild(container.firstChild); + } + + container.appendChild(content); + } + return this; },