<!DOCTYPE html>
<html>
<style>
#myDIV {
width: 220px;
height: 300px;
border: 1px solid black;
display: flex;
}
</style>
<body>
<p>Click the "Try it" button to set the flex property of ALL DIV elements inside the "myDIV" element:</p>
<button onclick="myFunction()">Try it</button>
<div id="myDIV">
<div style="background-color:coral;">RED</div>
<div style="background-color:lightblue;">BLUE</div>
<div style="background-color:lightgreen;">Green div with more content.</div>
</div>
<script>
function myFunction() {
const x = document.getElementById("myDIV");
const y = x.getElementsByTagName("DIV");
let i = 0;
for (i; i < y.length; i++) {
y[i].style.msFlex = "1";
y[i].style.flex = "1";
}
}
</script>
</body>
</html>