Litepicker icon indicating copy to clipboard operation
Litepicker copied to clipboard

When typing in an associated input box getting typeError

Open harrington101 opened this issue 3 years ago • 0 comments

Describe the bug When typing in an associated datepicker's input box the console is throwing an error, "Uncaught TypeError: Cannot set property 'innerHTML' of null - at e.render (litepicker.min.js:formatted:950) at e.onInput (litepicker.min.js:formatted:796)

This is similar to https://github.com/wakirin/Litepicker/issues/95. I am using version 2.0.10.

Here is the code throwing the error: this.ui is undefined when you type in the input box as opposed to selecting from the date picker.

if (this.ui.innerHTML = "",
            e.appendChild(i),
            this.options.resetButton) {
                var h = void 0;
                "function" == typeof this.options.resetButton ? h = this.options.resetButton.call(this) : ((h = document.createElement("button")).type = "button",
                h.className = a.resetButton,
                h.innerHTML = this.options.buttonText.reset),
                h.addEventListener("click", (function(e) {
                    e.preventDefault(),
                    t.clearSelection()
                }
                )),
                e.querySelector("." + a.monthItem + ":last-child").querySelector("." + a.monthItemHeader).appendChild(h)
            }
            this.ui.appendChild(e),
            this.options.autoApply && !this.options.footerHTML || this.ui.appendChild(this.renderFooter()),
            this.options.showTooltip && this.ui.appendChild(this.renderTooltip()),
            this.ui.dataset.plugins = (this.options.plugins || []).join("|"),
            this.emit("render", this.ui)
        }

harrington101 avatar Apr 01 '21 17:04 harrington101