jQuery .each() to get values of multiple divs
<p>I am trying to calculate the width and difference between the widths of a div and the text in a page where the same div class appears multiple times.</p>

<p>The HTML:</p>

<pre><code>&lt;div class="post_content"&gt;
       &lt;div class="container"&gt;
          &lt;div class="title-holder"&gt;
          &lt;h2&gt;&lt;a href="link.html" class="widget-title"&gt;Crossword Book&lt;/a&gt;&lt;/h2&gt;
          &lt;/div&gt;
       &lt;/div&gt;

      &lt;div class="container"&gt;
         &lt;div class="title-holder"&gt;
         &lt;h2&gt;&lt;a href="link.html" class="widget-title"&gt;Crossword Bookstore Ltd. &amp;ndash; Elgin Road&lt;/a&gt;&lt;/h2&gt;
         &lt;/div&gt;
      &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The CSS:</p>

<pre><code>div.container{
  width: 130px;
}
div.title-holder {
  width: 130px;
  height:20px;
  text-align:center;
  background: silver;
  overflow:hidden;
  position: relative;
}
div.title-holder a {  
  position: relative;  
  white-space:nowrap;  
  left: 0px;
}
div.image{
  background: brown;
  width: 100%;
  height: 100px;
}
</code></pre>

<p>The following script outputs the result of the first div correctly and then repeats the same result. It is not going to the next div and giving the next result.</p>

<pre><code>$("div.title-holder").each(function(){    
  var m = $(this).width();
  var n = $("div.title-holder h2 a.widget-title").width();
  var o = m - n;

  alert ("title: " + m + " text: " + n + " diff: " + o);    

}); 
</code></pre>

<p>The output is </p>

<pre><code>First Alert: title: 130 text: 108 diff: 22
Second Alert: title: 130 text: 108 diff: 22
</code></pre>

<p>What I am looking to achieve is </p>

<pre><code>First Alert: title: 130 text: 108 diff: 22
Second Alert: title: 130 text: 258 diff: -128
</code></pre>
