elink12,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<script>
(function($) {
var pluginName = 'Plugin',
defaults = {
propertyName: "value"
},
options = {};
function Plugin( element, options ) {
this.element = element;
this.options = $.extend( {}, defaults, options) ;
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function (e) {
console.log(this.options);
$(this.element).click(this.click.bind(this));
},
click : function(){
console.log(this.options);
}
};
$.fn.Plugin = function ( options,event ) {
return this.each(function () {
new Plugin( this, options );
});
}
})(jQuery);
$( document ).ready(function() {
$('#alert').Plugin({color:'green'});
$('#alert1').Plugin({color:'red'});
});
</script>
<div id='alert'>alert</div>
<div id='alert1'>alert1</div>
</body>
</html>