How do I extract a number from an HTML span using jQuery?
<p>Using jQuery, I would like to extract a number from a <code>&lt;span&gt;</code> and use it to calculate a new value.</p>

<pre><code>&lt;div class="post-100" data-postid="100"&gt;
   &lt;span class="score"&gt;3&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>I've got the general Idea, but I can't figure out how to reference the existing span value:</p>

<pre><code>if (response.newvoteid == null)
{
    $(".post-" + $(this).data("postid") + " .score").text(
            parseInt( **EXISTING VALUE + 1 OR -1**));
}
</code></pre>

<p><strong>Update:</strong> I am now using the following which fails to calculate the new value, but simply adds a number to the text. For example, <code>&lt;span class="score"&gt;3&lt;/span&gt;</code> becomes <code>&lt;span class="score"&gt;31&lt;/span&gt;</code></p>

<pre><code>var number = $(".post-" + $(this).data("postId") + " .score").text();
$(".post-" + $(this).data("postId") + " .score").text(number + 1);
</code></pre>
