Skip to content
Justice Tech School

The this Keyword

Inside an event handler, this is the DOM element that triggered it. Wrap it in $(this) to use jQuery methods.

Example
$('li').click(function () {
  $(this).css('color', 'blue');
});

Exercise

Wrap the element.

$()

Quiz Test

What is this in a handler?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.