by simon baird

Monday, July 20, 2009

Hello world in TiddlyWiki 2.5 and jQuery

Not sure if there is or will be a jQuery-ish createTiddlyButton. But in any case here is a super basic example to get you started with jQuery and TiddlyWiki...

http://jquery-hello.tiddlyspot.com/#JQueryHelloPlugin

(Presuming you know a little bit of pre-jQuery TiddlyWiki here, for example I haven't even put in all the macro handler params).

See it in action...

/***
<<jQueryHello>>
***/
//{{{
(function($){

$.extend(config.macros,{
jQueryHello: {
handler: function(place) {
createTiddlyButton(place, "click me", "click me", function() {
$(place).parent("div.tiddler").hide("slow").show("slow"); // woah
$(place).append("We're not in kansas any more, Toto.<br>");
});
}
}
});

})(jQuery);
//}}}

No comments: