I need to sort a set of 3 divs on a container in this way.
div class A
div class A
div class B
div class A
div class A
div class B
every 3rd div must be class B, how can i do this and then push te new order to the container ?
Thanks,
I need to sort a set of 3 divs on a container in this way.
div class A
div class A
div class B
div class A
div class A
div class B
every 3rd div must be class B, how can i do this and then push te new order to the container ?
Thanks,
To help you get started, here is one of many ways you might attack the problem.
This example uses querySelectorAll to find the two types of blocks. Then it uses a loop to move the blocks into the desired order.
To view the complete demo, click "Show code snippet" and then the blue "Run code" button.