There are countless tutorials on the web about how to write jQuery plugins. This is not a tutorial, it’s just a couple of very simple templates for creating your own jQuery methods and plugins (with callback functions) from scratch. These examples are chainable.

$.fn.methodName´┐╝ = function(){
    // 'this' refers to the matched elements (by selector)
    return this.each(function(index, element){
        var $this = $(this);	// DOM element object
		// do something with the objects	´┐╝

// Calling the method

A working example of method creation (and a simple check to determine if a method exists) is available on CodePen.

;(function($,window,document,undefined) {
       myPlugin: function(options){
            var defaults = {
            		// define default options and their values
                	option1		: 'Hi there!',
                	option2		: null,
                	complete	: function() {}
            	options = $.extend(defaults, options),
				o = options;	// can call options using "o" instead of "options";	

            return this.each(function(){
            	var $this = $(this);
            	// Perform your desired functionality
				// Callback
				if ($.isFunction(o.complete)) {	// check that the callback is a function
	; // apply scope to the callback function
}) (jQuery,window,document);

// Call the plugin	
$(function() {
		option1: 'Hello world!',
		option2: 'blue',
		complete: function() { console.log('This is a callback function!'); }

A working example of this plugin template is available on CodePen. Code is also available in a GitHub Gist.