Alex Rivera | Logout

Jquery - When to use "this" and when to use "$(this)"?

Asked 2011-12-12T03:25:59.253
13

Possible Duplicate:
jQuery $(this) vs this

What is the difference between "this" and "$(this)"?

How do I know which one to use?

Related, I think:

With each, you have the optional parameters. How is the "i" different than "this" (or "$(this)")?

$('img').each(function(i) { ....code }

vs.

$('img').each(function() { ....code }
Edit
Report

1 Answer

2

this in jQuery generally points to a DOM element, such as HTMLSelectElement.

Rewrapping it with the jQuery function allows you to call jQuery methods on it.

answered 2011-12-12T03:31:55.067

Your Answer