TAG
JavaScript
Result
Run
License
<h5>Click to item.</h5> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> </ul>
$(function() { $("ul > li").click(function() { $(this).css("color", function() { return $(this).index() % 2 == 0 ? "#FF0000" : "#0000FF"; }); }); });
Console
expand_less
License
License
by DevDic
Close