我有一个常规的无序列表链接,我想用 js 改变它
<ul>
<li><a href="#">Theme 1</a></li>
<li><a href="#">Theme 2</a></li>
<li><a href="#">Theme 3</a></li>
<li><a href="#">Theme 4</a></li>
<li><a href="#">Theme 5</a></li>
<li><a href="#">Theme 6</a></li>
<li><a href="#">Theme 7</a></li>
<li><a href="#">Theme 8</a></li>
<li><a href="#">Theme 9</a></li>
<li><a href="#">Theme 10</a></li>
<li><a href="#">Theme 11</a></li>
<li><a href="#">Theme 12</a></li>
</ul>
我想要以下输出:
<div class="themes__row">
<div class="themes__item><a href="#">Theme 1</a></div>
<div class="themes__item><a href="#">Theme 2</a></div>
<div class="themes__item><a href="#">Theme 3</a></div>
<div class="themes__item><a href="#">Theme 4</a></div>
</div>
<div class="themes__row">
<div class="themes__item><a href="#">Theme 5</a></div>
<div class="themes__item><a href="#">Theme 6</a></div>
<div class="themes__item><a href="#">Theme 7</a></div>
<div class="themes__item><a href="#">Theme 8</a></div>
</div>
<div class="themes__row">
<div class="themes__item><a href="#">Theme 9</a></div>
<div class="themes__item><a href="#">Theme 10</a></div>
<div class="themes__item><a href="#">Theme 11</a></div>
<div class="themes__item><a href="#">Theme 12</a></div>
</div>
我来回尝试了几种不同的解决方案,但最终变得非常混乱,所以我真的没有任何代码可以显示。这是如何巧妙地完成的?如果这很重要,该站点正在使用 jQuery 1.4.4。