第二条语句在此代码:
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来阅读文本 –