常見報錯——Uncaught TypeError: document.getElementsByClassName(...).addEventListener is not a function
這是因為選擇器沒有正確選擇元素物件
document.getElementsByClassName(...)捕捉到的是該類名元素的陣列
正確的訪問方式應該是:
document.getElementsByClassName(...)[0].addEventListener...
使用遍歷為每個class新增監聽:
var classObj = document.getElementsByClassName(...);
for(i=0;i<classObj.length;i++){
classObj[i].addEventListener...
}
相關推薦
常見報錯——Uncaught TypeError: document.getElementsByClassName(...).addEventListener is not a function
這是因為選擇器沒有正確選擇元素物件 document.getElementsByClassName(...)捕捉到的是該類名元素的陣列 正確的訪問方式應該是: document.getElementsByClassName(...)[0].addEventListener... 使用遍歷為每個class新增監
百度地圖js報錯Uncaught TypeError: b.ga(...).nb is not a function
事件:百度地圖非同步批量建立marker,單擊單個marker彈出對話方塊報錯。 報錯: VM1771:1 Uncaught TypeError: b.ga(...).nb is not a function at HTMLSpanElement.eval (eval at zZ (getscri
Vue表格複用,報錯"TypeError: _self.$scopedSlots.default is not a function"
場景:單頁面做可切換的多報表展示 如圖:每個報表戰術展示不同的資料項,需要隨select的切換,複用對應的table 這樣寫會報錯,並且切換後的table選項沒有達到預期效果 <el-main style="padding:10px;overflow-y:hidden"&g
jquery-ui.min.js:5 Uncaught TypeError: b.nodeName.toLowerCase is not a function
1、錯誤描述2、錯誤原因 jquery UI通過按鈕彈出視窗,然後在視窗上的按鈕,點選後再次彈出視窗,出現報錯 錯誤原因是輸入框中id和name命名為nodeName <i
vue 中報錯 Error in mounted hook: "TypeError: handlers[i].call is not a function"
你會發現出現這個錯誤了,但是並沒有影響到專案的執行,(推下眼鏡),作為一個經常假裝認真的我,覺得還是解決掉的好,避免為以後留下隱患。 直接看這個錯誤你會發現,沒有任何的頭緒,那麼就從他給的報錯下的提示看看,可能有問題的元件有哪些;看完以後你會發現,這些都和生命週期鉤子函式有
Combobox報錯:row[opts.textField].toLowerCase is not a function。
light peer mem div clas erro sea error () 使用easyui框架加載combobox。 html頁面: <span class="search_item"> <span class="item_text">
錯誤btn.addEventListener is not a function
今天碰到了這個錯誤,百度了很久沒有結果 嘗試很多方法來解決這個錯誤,其中一種嘗試報錯為:document.getElementsByClassName(...).addEventListener is not a function 直接百度,找到解決辦法:https:
jquery-1.8.3中的BUG typeError:elem.nodeName.toLowerCase is not a function
ie和firefox一直遇到這個問題----------------------------------------------------------------------------------| typeError:elem.nodeName.toLowerCas
Error in render: "TypeError: _self.$scopedSlots.default is not a function"
今天在做專案中遇到了如上圖這樣一個問題,專案是Vue+element-ui。原因是table中用了多個v-if,解決方案有兩個: 1、用v-show代替v-if(個人推薦用第二種); 2、在v-if條件語句中加key作為區分就不會報錯了。 <el-table
js報錯 Uncaught TypeError: xxxx.each is not a function
each err typeerror span xxx list 報錯 pan 使用 在處理ajax返回的json數組時錯誤的使用了 list.each(function(){ }); 實際上當遍歷json數組是應該使用
模態視窗(登陸) 報錯:forebought:14 Uncaught TypeError: $(...).modal is not a function
在點選一個地方觸發模態視窗的時候報如下錯誤:forebought:14 Uncaught TypeError: $(...).modal is not a function 錯誤原因:我只匯入了j
jQuery提交表單報錯 Uncaught TypeError: s[y] is not a function
使用jQuery提交表單的時候,頁面沒有反應,F12除錯發現點選提交按鈕,控制檯報錯 Uncaught TypeError: s[y] is not a function 問了百老師:發現可能是在form表單裡面 有一個input的id=“submit”,修改後,成功解決。
js錯誤Uncaught TypeError: $(...).datagrid is not a function自己寫的並沒有錯但是一直報這個錯(詳解)
自己寫的jsp程式碼並沒有錯,如圖 但是在瀏覽器中一直報錯 如圖 這個問題搞了半天主要是因為 我引用了eaeasyUi的包 又引用了jquery的包 這就相當於十多歲的你和現在的你 都是一
jquery.min.js?v=2.1.4:4 Uncaught TypeError: (b.contentType || "").indexOf is not a function
前臺運行 gpo 前臺 add cati json log ont fun 前臺運行PUT時出現錯誤:jquery.min.js?v=2.1.4:4 Uncaught TypeError: (b.contentType || "").indexOf is not a fun
Uncaught TypeError: o.block is not a function
erro TP 9.png .com In type ima alt typeerror 未捕獲TypeError:o。block不是一個函數 js少引,或者路徑錯誤Uncaught TypeError: o.block is not a function
Uncaught TypeError: window.showModalDialog is not a function 谷歌
sop fun replace 原創文章 aso csdn 版權 使用 parent //新版本谷歌沒有window.showModalDialog,創建一個window.openif(window.showModalDialog == undefined){ windo
window.showModalDialog 在谷歌Uncaught TypeError: undefined is not a function
oda help fun use 版權 index typeerror undefine modal if(navigator.userAgent.indexOf("Chrome") >0 ){var winOption = "height="+height+",wi
TypeError: value.getTime is not a function (elementUI報錯轉載 )
"TypeError: value.getTime is not a function" 2018年07月02日 16:41:24 leeleejoker 閱讀數:2091 標籤: vueelementUI報錯d
random.html:20 Uncaught TypeError: (intermediate value)(...) is not a function
Uncaught TypeError: (intermediate value)(…) is not a function (function ($) { console.log($('div').html()) })(jQuery)
Uncaught TypeError: $(...).bootstrapValidator is not a function
第一次使用bootstrapValidator,結果啥檔案都給匯入了,居然報錯!!! <link rel="stylesheet" type="text/css" href="../css/homePage.css"> <link rel="stylesheet" href