Custom jQuery plugin to manipulate tabs

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”&gt;
<html xmlns=””&gt;
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Jquery Custom Plugin</title>

(function ($){
$.fn.Tabs = function (options){
var settings = $.extend({
color : “#000000”,
background : “#ffffff”,
container : ”,
dafault : 1
}, options );

‘color’: settings.color,
‘background-color’: settings.background


$(‘#’+settings.dafault).css( “color”, “red” );

$(this).children(“a”).on(‘click’, function() {
$(this).css( “color”, “red” );


$.fn.ResetAll = function() {
this.find( “a” ).css( “color”, “black” );


$( document ).ready(function() {
$( “#test” ).Tabs({
color: “#000000”,
background: ‘#cccccc’,
container: ‘test’,
dafault : 1

border:1px solid #000000;
.cont a{
text-decoration: none;
border:2px solid #000000;


Tab 1
Tab 2
Tab 3

In addition, the primary purpose of an Immediately Invoked Function is to allow us to have our own private variables. Pretend we want a different color green, and we want to store it in a variable.
It’s good practice when writing plugins to only take up one slot within $.fn. This reduces both the chance that your plugin will be overridden, and the chance that your plugin will override other plugins. In other words, this is bad.
.pagerLink {
background-color: #E4F5F8;
border: 1px solid #C0DEED;
text-decoration: none !important;


other 1
other 2
other 3


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s