Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods.

jQuery.fn.extend(object)🡢 Object

object ObjectAn object to merge onto the jQuery prototype.
The jQuery.fn.extend() method extends the jQuery prototype ($.fn) object to provide new methods that can be chained to the jQuery() function.

Add two methods to the jQuery prototype ($.fn) object and then use one of them.

<label><input type="checkbox" name="foo" /> Foo</label>
<label><input type="checkbox" name="bar" /> Bar</label>
label {
  display: block;
  margin: 0.5em;
  check: function () {
    return this.each(function () {
      this.checked = true;
  uncheck: function () {
    return this.each(function () {
      this.checked = false;

// Use the newly created .check() method

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)