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();
});
--
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){
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/
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();
});
--