jQuery Sequential List


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $("#step li").each(function (i) {
  2. i = i+1;
  3. $(this).addClass("item" i);
  4. });
  5.  
  6. -- Alt
  7.  
  8. $("#step li").each(function (i) {
  9. $(this).addClass("item" + (++i));
  10. });
  11.  
  12.  
  13. $("#commentlist li").each(function (i) {
  14. i = i+1;
  15. $(this).prepend('<span class="commentnumber"> #' i '</span>');
  16. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.