第二條語句在此代碼:
var $this = $(this).children('div.submenu1').children('a.subtile')[0],
title = $this.text(),
name = $this.attr('node').val;
產生這個錯誤:
Uncaught TypeError: $this.text is not a function
當我將鼠標懸停在$this.text()
在Chrome調試器,我可以看到我想要的價值在title
。
我該如何解決這個錯誤?
$這是DOM對象不是,jquery對象,要麼包裝它像$($ this).text()ot $ this.innerText來閱讀文本 –