Trying to figure out how to do this with pure js so jquery isn't an option.
Say I want to grab all paragraph tags in a div and insert a new div after every paragraph that does not contain a single image or some other criteria.
Assuming I get all paragraphs like:
const paragraphs = document.getElementsByTagName("p");
how can I loop through every paragraph, evaluate if it meets the criteria and append a div if it does? I'm realizing a for loop through every element of the HTMLCollection paragraphs is not an option because HTMLCollections are live.
What is the most efficient way to accomplish this with pure javascript, assuming the newest version of Chrome is used.