Re: [jQuery] Nest and anchor in a header

2007-03-23 Thread Klaus Hartl
Dan Eastwell schrieb: How can I change this: h2text/h2 h2other text/h2 to this: h2a href=#text/a/h2 h3a href=#other text/a/h3 Thanks, Dan. Try (untested): $('h2+h2').each(function() { var $$ = $(this); $$.before('h3a href=#' + $$.text() + '/a/h3').remove(); }); --

Re: [jQuery] Nest and anchor in a header

2007-03-23 Thread Dan Eastwell
Sorry, I specified my problem incorrectly. Apologies. I meant to ask 'how do you wrap the text in an element in an anchor, if that's the only node within that element'. This was my solution, although it's very long and unwieldy: function wrapTextInAnAnchor(theElement){

[jQuery] Nest and anchor in a header

2007-03-22 Thread Dan Eastwell
How can I change this: h2text/h2 h2other text/h2 to this: h2a href=#text/a/h2 h3a href=#other text/a/h3 Thanks, Dan. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] Nest and anchor in a header

2007-03-22 Thread Klaus Hartl
Dan Eastwell schrieb: How can I change this: h2text/h2 h2other text/h2 to this: h2a href=#text/a/h2 h3a href=#other text/a/h3 Thanks, Dan. Try (untested): $('h2+h2').each(function() { var $$ = $(this); $$.before('h3a href=#' + $$.text() + '/a/h3').remove(); }); --