javascript - Uncaught TypeError: $this.text is not a function -


the second statement in code:

var $this = $(this).children('div.submenu1').children('a.subtile')[0], title = $this.text(), name = $this.attr('node').val; 

produces error:

uncaught typeerror: $this.text not function 

when hover on $this.text() in chrome debugger can see value want have in title.

how can fix error?

this happening because you're assigning variable $this native dom reference, not jquery reference. latter has access jquery api.

you're doing 'reaching inside' array-like jquery stack , extracting native reference, via [0]. lose , it'll work:

var $this = $(this).children('div.submenu1').children('a.subtile'), title = $this.text(), //<-- has access jquery api 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -