Jquery filter class and set as a variable
<p>I am trying to get the class of a clicked element eg.  '.thumbs1' and set it as a variable but remove everything but the number '1'. </p>

<p>I have found a way to remove everything but the number using the following code but i do not know the syntax to store it as a variable.</p>

<pre><code>$(this).attr('class').replace(/[^\d]/g, ''); 
</code></pre>

<p>I want to do something like:</p>

<pre><code>var i = $(this).attr('id').replace(/[^\d]/g, '');
</code></pre>

<p>This is obviously wrong but you get the idea. Ta</p>
