I’m using replaceWith() to replace a link with another link with a different onchange and an internal span tag, like so:
$(a.class).replaceWith("<a onclick='return ajax_spam(this);' /><span>Unflag as Spam</span></a>");
This works except for the span tag is placed after the closing tag. Same happens if I replace the span tag with just text.
Any ideas?
You’re prematurely closing the
atag…change:
<a onclick='return ajax_spam(this);' /><span>Unflag as Spam</span></a>to:
<a onclick='return ajax_spam(this);' ><span>Unflag as Spam</span></a>