I like that, especially the new dom element creation ... does it also include any nifty way to do nested element creation like the dom creation plugins?
Kawika John Resig wrote: > This is some great code - I really dig it. It's super simple, which is good. > > Just as a mini-tutorial to the upcoming 1.0b, here are some of the > changes that are possible: > > jQuery.fn.checkbox = function (opt) { > $("[EMAIL PROTECTED]'checkbox']", this).hide().each(function(){ > $("<img>") > .src( this.checked ? opt.checked : opt.unchecked ) > .click( function() { > var check = this.src == opt.checked; > > $(this) > .src( check ? opt.unchecked : opt.checked ) > .next().attr( "checked", check ? "" : "checked" ); > }).insertBefore( this ); > }); > }; > > I'm not saying that mine is any better - just using this as a > demonstration of what's possible. > > --John > >> Example >> http://kawika.org/jquery/checkbox/ >> >> >> Code >> jQuery.fn.checkbox = function (opt) { >> >> $("[EMAIL PROTECTED]'checkbox']", this).each( function () { >> >> var img = document.createElement("img"); >> img.src = this.checked ? opt.checked : opt.unchecked; >> >> $(img).click( function() { >> >> var input = this.nextSibling; >> if ( input.checked ) { >> this.src = opt.unchecked; >> input.checked = ""; >> } >> else { >> this.src = opt.checked; >> input.checked = "checked"; >> } >> }); >> >> $(this).parent().prepend(img) >> $(this).hide(); >> }); >> } >> >> >> Usage >> $(document).ready( function () { >> $().checkbox({checked: "accept.png", unchecked: "cancel.png"}); >> }); > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/