Bug Tracker

Opened 9 years ago

Closed 9 years ago

#13570 closed bug (notabug)

error in the description: addClass

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: git
Keywords: Cc:
Blocked by: Blocking:



<script type="text/javascript">
   $("ul li:last").addClass(function(index) {
      return "item-" + index;
   $("ul li").each(function(){


"Given an unordered list with five <li> elements, this example adds the class "item-4" to the last <li>."

not "item-4" -> "item-0"

Change History (2)

comment:1 Changed 9 years ago by m_gol

This is expected, indexes go from 0. What did you expect? Also, if you think that something is broken, don't just paste code here but go to jsfiddle.net and create a test case that clearly states what you expect and demonstrates that it doesn't to that.

comment:2 Changed 9 years ago by timmywil

Resolution: notabug
Status: newclosed
Note: See TracTickets for help on using tickets.