Return to Snippet

Revision: 57137
at May 17, 2012 22:37 by satie83


Initial Code
<script type="text/javascript"
src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js">
</script>
 
<script type="text/javascript">
    $(function () {
        $('ul > li').each(function () {
            $(this).prepend("(" + 
                ($(this).index() + 1) + ") ");
        });
    })
</script>

Initial URL
http://www.devcurry.com/2011/06/jquery-numbering-unordered-list.html

Initial Description
Here’s a very simple script which adds numbers sequentially to an unordered list using jQuery

Initial Title
jQuery: Numbering an Unordered List

Initial Tags
javascript, html, DOM, jquery

Initial Language
jQuery