JQUERY PLUGIN 1
by gurkavcu
HTML
<script src="http://rniemeyer.github.com/KnockMeOut/Scripts/knockout-latest.debug.js"></script>
<script src="https://raw.github.com/SteveSanderson/knockout.mapping/master/build/output/knockout.mapping-latest.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.0/css/bootstrap-combined.min.css">
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.0/js/bootstrap.min.js"></script>
<p id="foo">TEST</p>
CSS
.wu-tang {
font-family :'Lucida Console';
font-size: 24px;
}
JavaScript
var link="http://ajpiano.com/widgetfactory/#slide5";
(function ($) {
function Redman(elem) {
this.init(elem);
}
Redman.prototype.init = function (elem) {
this.element = $(elem).addClass("wu-tang").css("color", "red");
};
Redman.prototype.destroy = function () {
this.element.removeClass("wu-tang").removeAttr("style");
};
$.fn.redman = function () {
return this.each(function () {
// Instantiate a new Redman, storing the instance in the element's data cache
$.data(this, "redman", new Redman(this));
});
};
})(jQuery);
$(function () {
$("<input>", { type: "input" , value: "hasan"}).appendTo($("body"));
$("<input>", { type: "checkbox" , checked: true}).appendTo($("body"));
var r = $("#foo").redman().data("redman");
setTimeout(function () {
r.destroy()
}, 2000);
});