extraxt html from selected + cloned elements
by bjelline
HTML
<h1>Input</h1>
<div>a</div>
<div class="yes">b <b>some</b></div>
<div>c</div>
<div class="yes"><i>other</i> e</div>
<h1>Output</h1>
<div id='output'></div>
CSS
.ready { background-color: lightgreen; }
JavaScript
var $selected = $('.yes').clone();
$('#output').append($selected.length + " Elements selected, ");
$selected.each(function() {
$('#output').append($(this));
var x = $('<pre>').text( $(this).html() );
$('#output').append( x );
});