Hi. This has to be a simple oversight on my part, but for the life of me I can't figure it out. Consider the following (simplified) HTML:

HTML Code:
<div id="chalk">
<a name="bk_99"></a>
<div class="chalk_entry">
  <div class="chalk_message">...</div>
  <div class="chalk_block">
    <div id="msg_114" class="inner_chalk_entry">
      <div class="inner_chalk_message">...</div>
    </div>
    <div id="msg_115" class="inner_chalk_entry">
      <div class="inner_chalk_message">...</div>
    </div>
  </div>
</div>
<a name="bk_72"></a>
<div class="chalk_entry">
  <div class="chalk_message">...</div>
  <div class="chalk_block">
    <div id="msg_73" class="inner_chalk_entry">
      <div class="inner_chalk_message">...</div>
    </div>
  </div>
</div>
</div>
For the sake of simplicity, let's say that I want to change the color of the text within the DIVs with the IDs msg_115 and msg_73 (the last ones in each "block"). Here is the Javascript I'm attempting to do this with:

Code:
$('#chalk>a').each(function(){
    var lastId=$(this).next('.chalk_entry .chalk_block .inner_chalk_entry:last').attr('id');
    $('#' + lastId).css('color','green');
});
When this runs, it only changes the color of the text within the DIV with the id of "msg_73". I assume I'm doing something wrong with the "last" filter, but what? Any help would be greatly appreciated.