JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
    var matchedElements = document.querySelectorAll("#myContainer div[id^='prefix']");
    
   forEach = Array.prototype.forEach;
    
    forEach.call(matchedElements, function (el) { el.parentNode.removeChild(el); } );
 
}
</script>
</head>
<body onload="myFunction()">
    
<div id="myContainer">
    <div id="prefixNumbers1">prefixNumbers1</div>
    <div id="prefixNumbers2">prefixNumbers2</div>    
    <div id="prefixNumbers3">prefixNumbers3</div>    
    <div id="prefixNumbers4">prefixNumbers4</div>
</div>
    <div id="prefixNumbers5">prefixNumbers5</div>
</body>
</html>

JavaScript

<!DOCTYPE html>