Per effettuare il parsing di un documento HTML con jQuery bisogna considerarlo come XML.
Dato il seguente documento:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="item">A</div>
<div class="item">B</div>
<div class="item">C</div>
</body>
</html>
Effettueremo il parsing in questo modo:
var options = {
type: "GET",
dataType: "xml",
url: "/pages/test.html"
};
$.ajax( options ).done(function( html ) {
var $doc = $( html );
var $items = $doc.find( ".item" );
$items.each(function() {
//...
});
});