Tuesday, July 31, 2012

Comment Counter Code Available!

Good morning! I'm so excited that my programmer husband, Tom, made the COMMENT COUNTER gadget now work with the updated blogger stuff. Yeah! Thanks, Tom!  You guys are welcome to copy and paste the code below as an HTML gadget to your Layout if you would like your comments to be numbered.

IMPORTANT: You MUST choose the EMBEDDED option in SETTINGS for COMMENTS.  This numbering system will NOT work with pop-up comments.

Find step-by-step photos below. :)

ENJOY! This code is FREE if you'd like to use it. :)

<style type="text/css">
.commentNumber {
border: 0px solid Black;
display: inline;
color: #6FA8DC;
font-weight: bold;
<script type="text/javascript">
function getElementsByClassName2(className, tag, elm){
 var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
 var tag = tag || "*";
 var elm = elm || document;
 var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
 var returnElements = [];
 var current;
 var length = elements.length;
 for(var i=0; i<length; i++){
  current = elements[i];
 return returnElements;
function addCounters()
       var numBox, i, j;

       var topComments = getElementsByClassName2("comment-thread")[0].firstChild.children;
       for (i = 0, j = topComments.length; i < j; i++)
               var commentBlock = getElementsByClassName2("comment-block", "*", topComments[i])[0];
               numBox = document.createElement("span");
               numBox.className = "commentNumber";
               numBox.appendChild(document.createTextNode((i + 1) + ':'));
               commentBlock .firstChild.insertBefore(numBox, commentBlock .firstChild.firstChild);

If you want to see what this looks like in use... as soon as someone leaves me at least 1 comment on this post, it will start the numbering. Just click on my BLOG TITLE so that this post and it's comments are the only thing showing on the page. You'll see the comments numbered. I just love that he did this for me and all my friends. Sure does make it easier when doing a give-away and using to pick a winner and not having to count the comments. 

Have a GREAT day!
:) Janis

Click on photos to enlarge for better viewing. 


  1. Awesome! Tom Rocks!! TFS Janis :)


  2. This is awesome!!! Thank you for sharing it Janis!!


  3. OMG! Thank you for sharing this information. I just did it! Wow! This makes it so much easier when looking for the winner of blog candy after using Random. Org. You are truly a life saver. Thanks to your hubby also.


  4. TFS and thanks for the step by step! This is so awesome and works perfectly!!!!

  5. OMG Please tell your hubby I love him so much!!!!!!!!! THANK YOU THANK YOU THANK YOU! I have been seriously trying to figure out how to # my comments and none was working and this worked.

    Thank you for sharing this Janis, really appreciate.


  6. wow THANKS this is awesome...thanks Tom for your kindness in sharing this with us!! what a dandy Idea!!! I snagged it ...

  7. thank you so much janis this is real sweet of you to share. it works great. hugs

  8. Oh my stars...yes yes yes!!! Tom is the MAN! Give him a Big Kiss for me!

  9. Thank you so much for this, how super.

  10. This is so awesome. Woot Woot GO TOM GO! Thank You both so much. I so need this. I will be sure to share the awesome new. THANKS TOM!

  11. This is great! Thanks so much! Makes giving out prizes easier!



  12. WOW!!! Thanks SOOO much! Been trying to get something like this on my blog again! Had it once...then it disappeared for some reason! This is wonderful!!!

  13. Thanks to both of you for sharing this! I can't wait to see if it works!

  14. Let's hear it for TOM and for JANIS who were kind enough to post easy peasy directions for comment numbering on our worked so y'all come down and comment to your hearts content so I can see how great it works!! This is why I LOVE my blogger peeps...they share ALL the good stuff!!!
    creative Wishes,
    Claire S.

  15. THANK YOU FOR THIS AWESOME TUTORIAL!!! YAY!!! I have it on my challenge blog and will add it to my blog too. You rock!!!

  16. It doesn't work on either of my blogs either...not that I can see anyways. Bummer. I love this idea because I DO have contests and having the comments numbered would really help. Oh well! LOL!

  17. Thank you so much for this! Off to try it out now :)

  18. Please pass my thanks to your hubby. And thanks for the easy-to-follow installation instructions. I might have done it without them, but they really speeded things up.

  19. Thank you, thank you, thank you! Please tell hubby I said thanks too! This is going to be SO HELPFUL to me! I have a 4 year Blogaversary Candy going on through this month and it will certainly help with it comes time to draw a winner! Please feel free to come check it out ... and thanks ever so much again! I will be directing my friends to your site!
    Hugs from Ohio

  20. Thank you so much for posting this up! So sweet of you to post all the visiual insturctions, very helpful:)I just became a follwer and would love if you stopped by my blog and became a follower as well.

    Peace, Love, & Cricut Hugs!
    Monica L.

  21. Hey Janis. Thank you so much for this code. I finally remembered to link it with a new post and it worked great! Thanks so much Mrs Smarty Pants...hubby too. Holly :-)

  22. Janis, that is so sweet of you to do this, not only the counter, but instructions! Your dh must love you very much...he's a To both of you it's very much appreciated and a big thanks.

    Thanks a bunch!
    Dee B

  23. Ya thanks! I just added to my blog!

  24. You are amazing! I've been so sad that numbered comments have gone away. you made my day! Thanks to your husband for figuring it out and thanks to you for sharing! New follower...

  25. Janis, please tell Tom THANK YOU SO MUCH!! I used to have my comments numbered and it just disappeared. I added this and voila, they're back!! Thank you, thank you, thank you and your hubby for sharing this!! Hugs my sweet friend :)

    A Mermaid's Crafts

  26. I am sure this is something I will want Janis when I do my next blog candy - I need to research more so I can understand where to install it on my blog - I am a newbie - learning the ropes you know! Tell your hubby Tom - I think it is a wonderful, kind thing he has done -Very much appreciated! Have a great week! ~ Gail ~

  27. Jnis Thank your Hubby I used this on my blog also -- I would have gon e bananas trying to count all the comments.