Uncaught TypeError: $this.text is not a function

$this is a DOM object, not a jQuery object. Either wrap it like $($this).text() or $this.innerText to read text.


This is happening because you're assigning to the variable $this a native DOM reference, not a jQuery reference. Only the latter has access to the jQuery API.

You're doing this by 'reaching inside' the array-like jQuery stack and extracting the native reference, via [0]. Lose this and it'll work:

var $this = $(this).children('div.submenu1').children('a.subtile'),
title = $this.text(), //<-- now has access to jQuery API