0
沒有工作的div
this._createPickerElement = function() {
this.elem = document.createElement('div');
this.elem.setAttribute("id", "myDiv");
this.elem.classList.add('vanilla-color-picker');
var _this = this;
if (className) {
this.elem.classList.add(className);
}
var currentlyChosenColorIndex = colors.indexOf(this.targetElem.dataset.vanillaPickerColor);
for (var i = 0; i < colors.length; i++) {
this.elem.innerHTML += singleColorTpl(colors[i], i + 1,
i == currentlyChosenColorIndex, noColor);
}
this.targetElem.parentNode.appendChild(this.elem);
this.elem.setAttribute('tabindex', 1);
var toFocus = currentlyChosenColorIndex > -1 ? currentlyChosenColorIndex : 0;
this.elem.children[toFocus].focus();
this.elem.children[toFocus].addEventListener('blur', this_._onFocusLost);
重點IE11 不工作當我點擊this.elem.children [toFocus]不火單擊事件,只是模糊火
集中在IE
this.elem.children[toFocus].focus()
現在工作。 ...........
任何想法??
遺漏的類型錯誤:this.elem.children [toFocus]。選擇不是一個功能 –
對不起,我用它來做到這一點,但我只是驗證這僅用於HTMLInputElement *。但我更新了我的答案以反映這一點。 – Anonymous0day
謝謝!!元素是div,所以我改變了div到按鈕 –