I have simple one column HTML files (ebooks from Gutenberg Project).
I want to identify in the DOM the block elements (like <h1> <p> <div> <table> etc, not <a> <em> <b> etc) and enclose them in <div> tags.
Is there any easy way to do it in jQuery?
Thanks
You can use a selector for the elements elements you want and call
.wrap()for each, like this:This would wrap each one in a
<div>individually. It looks from your example page they use a known set of elements, so just add whichever one you want to the selector.