jQuery: Looping over an object with $.each()



The jQuery Code START
    
    <script type="text/javascript" src="./jquery-1.5.1.js"></script>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
  
    <script type="text/javascript">
      $(document).ready(function() {
        var obj = { one:1, two:2, three:3, four:4, five:5 };
        $.each(obj, function(i, val) {
           $("#" + i).append( document.createTextNode("Property " + i + " contains " + val));
        });
      });
    </script>
    
    <style type="text/CSS">
        <!--
        .code { color: red; }
        .back { background-color: yellow; }
        -->
   </style>
  </head>

  <body>
    <h1>jQuery: Looping over an object with $.each()</h1>
    <div id="one"></div>
    <div id="two"></div>
    <div id="three"></div>
    <div id="four"></div>
    <div id="five"></div>