[英]unable to addClass() to <tr>
onClick
的鏈接,我需要addClass()
的<tr>
其中包含的鏈接,並使其邊界黃色。 我試圖通過this.parent
訪問<tr>
,但是它不起作用。 我收到一個錯誤:
Uncaught TypeError: Cannot read property 'className' of null
我該如何解決?
編輯:
道場代碼:
function(dom, on, domClass){
on(dom.byId("link1"), "click", function(){
disableLink("link1");
disableLink("link2");
disableLink("link3");
domClass.add(this.parent.parent, "style1"); // not working!
});
});
parentNode
而不是parent
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.