How to remove some html from an element and append that new html in
another place on the page?
I need to remove some html from an element and insert that html into a new
spot on the page.
http://jsfiddle.net/QtaDg/
My attempts (commented out) aren't working.
HTML:
<ul>
<li>Hello</li>
<li class="bye">Bye</li>
</ul>
<div id="new-html"></div>
jQuery:
$('ul').find('.bye').remove().appendTo('new-html');
or
$('ul').find('.bye').remove().clone().appendTo('new-html');
No comments:
Post a Comment