Skip to content
Justice Tech School

Writing a Plugin

Extend $.fn to add methods.

Example
$.fn.highlight = function (color) {
  return this.css("background", color || "yellow");
};
$("p").highlight("pink");

Exercise

Extend.

$..highlight = fn

Quiz Test

Why return this?

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