JSFiddle - React, Tailwind, and code Playground
by a_robson
HTML
<div id="zero">
<div id="one">
<div id="shfifty">
<span id="five">
Hurp
</span>
<span id="dot">
ADURPLE
</span>
</div>
</div>
<span id="two"></span>
<span id="three"></span>
</div>
JavaScript
$(function() {
var root = $("div:first");
document.write("startin<br/>");
crawl( root );
document.write("donzo");
});
var crawl = function( root ) {
document.write( root.attr("id") + "<br/>");
try {
var children = root.children();
if( children !== undefined ) {
children.each( function( X, Y ) {
crawl( $( Y ) );
});
}
}
catch ( Ex ) {
document.write( "EXCEPTION!! " + Ex + "</br>" );
}
};