私はjqueryプラグインの基礎として以下を使用していますが、.find以降にいくつかの構文上の問題があるようです。クリック関数内のコードは呼び出されず、クラスは適用されません。誰かが私がここで間違っていたかもしれない場所を提案できますか?
(function($){
$.fn.expandCollapse = function(options){
var opts = $.extend({}, $.fn.expandCollapse.defaults, options);
function initialize(){
$(this).each(function(){
// code
}).find("p").click(function(){
// code
}).end().not(:first).addClass(opts.c);
}
initialize();
return $(this);
};
$.fn.expandCollapse.defaults = {
c: "collapsed"
};
})(jQuery);