я пишу
$.fn.ajajforms=function(options)
{
var settings=jQuery.extend({
load_url: '/test.js',
row_height: '22px'
},options);
var objs=[];
$("#debug").append("ajajforms started\n");
this.each(function() { objs[objs.length]=$.ajajforms(this,settings);} )
return objs;
}
$.ajajforms=function(div,settings)
{
$("#debug").append("ajajforms constructor()\n");
$div=$(div);
$div.addClass("ajajforms");
$div.append('<img src="/shared/progress.gif"/>');
var g={
settings: settings,
add_clicked: function() {...},
ещё куча кода...
};
return g;
...
}
$("#test").ajajforms();
<script>$("#test").add_clicked();</script>