Using .each to loop through elements

Using .each to loop through elements

I am trying to get elements into an array from a common ID.  This is my .each loop:
  1. $('*[id^="totalPrice"]').each(function() {

And this is my elements that I want to loop through:

  1. <span id='totalPrice".$id."'>

When I loop through, I only get one element returned.  With the listing, there are 3 elements.  Why is it not getting to the other two?