I could also do something along these lines: $.fn.oldText = $.fn.text; $.fn.text = function() { return $(document.createTextNode(this.oldText())); }
That is, of course, if I'd like to confuse the hell out of future maintainers :) On Sep 25, 1:15 am, Balazs Endresz <[EMAIL PROTECTED]> wrote: > I think the easiest way is to write another plugin: > > $.fn.$text=function(){ > return $( document.createTextNode( this.text() ) ) > > } > > $("a").$text().appendTo("#sanbox"); > > but you can extend the String prototype too: > > String.prototype.jqueryify=function(){ > return $( document.createTextNode( this ) ) > > } > > $('a').text().jqueryify().appendTo("#sanbox"); > > On Sep 24, 8:27 pm, 703designs <[EMAIL PROTECTED]> wrote: > > > Because the text method returns a string, it's missing appendTo and > > other methods. Now, of course I can do this: > > > $("#sandbox").text($("a").text()); > > > But I'd prefer to do this: > > > $("a").text().appendTo("#sanbox"); > > > What goes between text and appendTo? Or is the first example the best > > way to do this? > >