nickf nickf - 1 year ago 50
Javascript Question

Convert a jQuery set into HTML

Given a jQuery result set, how do you convert that back into plain HTML?

<div class="abc">
foo <strong>FOO</strong>
<div class="def">


var $mySet = $('div');

, how would you go about returning to the plain HTML above?


If your set consists of precisely one item, you can use ye olde Javascript:

var html = $mySet[0].outerHTML; // note HTML is all caps... that always burns me