JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<div id='test'>my div</div>
<div id='test2'>my div</div>
JavaScript
(function($) {
// create myPlugin
$.fn.myPlugin = function(options) {
// iterate through all selected matches
return this.each(function() {
// Change the color to blue
$(this).css('color','blue');
// Call the callback using the .call() method
// so that we can pass the value of "this"
// as the element in the iteration
options.callback.call(this);
});
};
})(jQuery);
$('div').myPlugin({
callback:function() { alert('the id is ' + this.id); }
});