User Tools

Site Tools


snippets:js:jquery-outerhtml

jQuery outerHTML

In search for retrieving posts in WordPress via AJAX, I stumbled upon this nifty snippet. Essentially replicates outerHTML in the jQuery way.

// html = returned data from AJAX respose
 
jQuery(html).find('article').get().map(function(v){return v.outerHTML}).join('');
snippets/js/jquery-outerhtml.txt · Last modified: 2022/07/21 11:23 by fwolf