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.wrapInner = function(e,s) {
return this.each(function(){
var o = $(this);
var c = o.html();
o.empty().append(e).find(s).append(c).end();
});
};

The modified example usage:
$('p').wrapInner('<a href="/"><\/a>','a');

To make this:
<p>Hello world!</p>

Into:
<p><a href="/">Hello world!</a></p>

Perhaps someone knows how make this work without the additional argument?

Cheers
Ollie

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to