Opened 11 years ago
Closed 11 years ago
#13570 closed bug (notabug)
error in the description: addClass
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | git |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
http://api.jquery.com/addClass/
<script type="text/javascript"> $(document).ready(function(){ $("ul li:last").addClass(function(index) { return "item-" + index; }); $("ul li").each(function(){ alert($(this).attr('class')); }); }); </script> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul>
"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 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
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.