我正在創建一個jQuery插件,我無法設置類/方法來適應api訪問我想。jQuery插件方法鏈接類佈局
這裏是我到目前爲止,但它不工作(我得到一個對象不支持此屬性或方法錯誤):
(function($){
$.kitty= function(name) {
this.name = name;
this.cat= function(say) {
alert( this.name + ": " + say);
}
};
})(jQuery);
我想用引起的輸出:
$.kitty('chairman meow').cat('meow!');
輸出:
chairman meow: meow!
你是對的!我不敢相信我錯過了那個;謝謝! – Christopher 2010-09-20 08:43:21