[Solved] I want to add dynamic class


You mean like this?

html

<div id="menu">
    <ul>
        <li>one</li>
        <li>two</li>
        <li>three</li>
        <li>four</li>
        <li>five</li>
        <li>six</li>
        <li>seven</li>
        <li>eight</li>
        <li>nine</li>
        <li>ten</li>
    </ul>
</div>

jquery

var i = 0;
var count = 5;
$("#menu ul li").each(function () {
    if (i < count) {
        i++
    } else {
        i = 1;
    }
    $(this).addClass("item-" + (i));
});

1

solved I want to add dynamic class