0

Possible Duplicate:
jQuery each this

I have a loop that iterates over every element of a certain class:

$(".myclass").each(function(i) {

});

I'm trying to get children of that element with this.find("tag"), but it gives me an error. Inside that loop, what, does this refer to? What about $(this)?

Community
  • 1
  • 1
Bluefire
  • 13,519
  • 24
  • 74
  • 118
  • Please read the [**jQuery tutorial**](http://docs.jquery.com/Tutorials%3aGetting_Started_with_jQuery). Its examples shows how to use `this` properly in callbacks. Also related: http://stackoverflow.com/q/1051782/218196. – Felix Kling Jan 24 '13 at 20:43

1 Answers1

8

this is the raw DOM node. If you want to use jQuery functions on it, you need to use $(this).

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592