Sam Collett schrieb:
> On 20/02/07, Oliver Boermans <[EMAIL PROTECTED]> wrote:
>> Served? Served what?
>>
>> On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote:
>>> I just got served :-(
>
> Dave knows something about jQuery that John doesn't (or he forgot about) ;)
>
> It does show that there can
On 20/02/07, Oliver Boermans <[EMAIL PROTECTED]> wrote:
> Served? Served what?
>
> On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote:
> > I just got served :-(
Dave knows something about jQuery that John doesn't (or he forgot about) ;)
It does show that there can be several ways to do the same th
Served? Served what?
On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote:
> I just got served :-(
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
Of John Resig
Sent: Monday, February 19, 2007 10:50 AM
To: jQuery Discussion.
Subject: Re: [jQuery] wrapinner with 1.1.1
It seems like this would be a better solution:
jQuery.fn.wrapInner = function(html){
return this.each(function(){
var wrap = $(html);
while ( this.firstChild
hildNodes).appendTo(this);
> });
> };
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of John Resig
> Sent: Monday, February 19, 2007 10:50 AM
> To: jQuery Discussion.
> Subject: Re: [jQuery] wrapinner with 1.1.1
>
> It seems like
I only did some basic testing, but this will do it:
jQuery.fn.wrapInner = function(html){
return this.each(function(){
var wrap = $(html), lowest = wrap[0].firstChild;
while ( lowest.firstChild )
lowest = lowest.firstChild;
while ( this.firstChild )
lowest.appendChild(
Tidy! Thanks John.
While that is suits my particular purpose nicely, I'm curious, how
would you to change it to insert the to-be-wrapped content into the
_deepest_ point in the supplied HTML snippet.
Like regular wrap. eg:
Usage:
$('p').wrapInner('');
To make this:
Hello world!
Into:
Hello world
It seems like this would be a better solution:
jQuery.fn.wrapInner = function(html){
return this.each(function(){
var wrap = $(html);
while ( this.firstChild )
wrap.append( this.firstChild );
wrap.appendTo( this );
});
};
no need for a filter, and you don't lose your eve
Hi!
Here is the new version.
jQuery.fn.wrapInner = function(o) {
return this.each(function(){
var jQ = jQuery(this);
var c = jQ.html();
jQ.empty().append(o.el).filter(o.id).html(c);
});
}
$("p").wrapInner({el: 'http://jquery.com";>', id:
Hey all,
I had some trouble today attempting to use the simple wrapinner plugin
with jquery 1.1.1.
http://motherrussia.polyester.se/jquery/wrapInner/
Some modification to the plugin code was required to make it do what I
was looking for.
// The additional argument is 's' (for selector)
$.fn.wra
10 matches
Mail list logo