Try the function below and see if you can get it to work as shown - you
probably won't be able to!!!
The example, as given, replaces the content of the <p> with the 'el' part,
but does not add a closing tag or put back the original content.
Karl Swedberg-2 wrote:
>
> Christian Bach just posted his .wrapInner() plugin to the discussion
> list about a week ago:
>
>> 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: 'a'});
>>
>> Before:
>> <p>I will become a link to jQuery.com</p>
>>
>> After:
>> <p> http://jquery.com I will become a link to jQuery.com</
>> a></p>
>
> --Karl
> _________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>
--
View this message in context:
http://www.nabble.com/Is-there-a-jQuery-way-to-do-an-innerWrap--tf3304247.html#a9202645
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/