JSFiddle - React, Tailwind, and code Playground

by elneco

HTML

<ul>
    <li>helllo</li>
    <li>helllo</li>
    <li>helllo</li>
    <li>helllo</li>
    <li>helllo</li>
    <li>helllo</li>
</ul>

CSS

li {background: blue; color: white; padding: 5px 15px; margin: 2px;}
div li {background: green;}

JavaScript

var myset = $("ul li");
for(var i = 0; i < myset.length; i+=2) {
  myset.slice(i, i+2).wrapAll("<div></div>");
}