How to break out of .each() by index number
javascript, jquery
Solution
You should use the nth-child pseudo selector
$("ul li:nth-child(3n)").addClass("break-here");
Problem
i want to break out each three items in a list and add a class to that child like; ``` <ul> <li>1</li> <li>2</li> <li>3</li><!--target list item--> <li>4</li> <li>5</li> <li>6</li><!--target list item--> <li>7</li> </ul> ``` any idea?