I have a list below. In which I want to wrap the last three li in another ul li tag.
My html
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
I want to
<ul>
<li>1</li>
<li>
<ul>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</li>
</ul>
my code
$('ul li:not(:first)').wrap('<li></li>');
But he tears the personality into another. Help in search engines
source
share